拼多多笔试编程

	private static void print(Node root, String string) {
		if(orignalRoot==root){
			System.out.println(string+root.name);
		}else {
			System.out.println(string+"-- "+root.name);
		}
		string=string.replace('`', ' ');
		
		PriorityQueue<Node> children=root.children;
		while (!children.isEmpty()) {
			Node child=children.poll();
			String string2;
			if(children.isEmpty()){//可以不加上|
				string2=root==orignalRoot?string+"`":string+"   `";
				print(child, string2);
			}else {
				string2=root==orignalRoot?string+"|":string+"   |";
				print(child, string2);
			}
		}
	}
花了很长时间,终于AC了,也是试了很久,因为不能复制,导致有的空格人眼没看出来。
另外,求问有AC第二题“样本挖掘”的吗?(30%,第一次碰到内存超出了的。。。)
全部评论
样本挖掘,时间超时,也是30%
点赞
送花
回复
分享
发布于 2017-09-02 17:15
你们的node怎么搞上去的,第一题用了多个类编译不通过放弃了
点赞
送花
回复
分享
发布于 2017-09-02 17:27
滴滴
校招火热招聘中
官网直投
跟后台开发的题目不一样啊
点赞
送花
回复
分享
发布于 2017-09-02 17:29

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务