拼多多笔试编程

	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%,第一次碰到内存超出了的。。。)
全部评论
跟后台开发的题目不一样啊
点赞 回复 分享
发布于 2017-09-02 17:29
你们的node怎么搞上去的,第一题用了多个类编译不通过放弃了
点赞 回复 分享
发布于 2017-09-02 17:27
样本挖掘,时间超时,也是30%
点赞 回复 分享
发布于 2017-09-02 17:15

相关推荐

04-18 15:58
已编辑
门头沟学院 设计
kaoyu:这一看就不是计算机的,怎么还有个排斥洗碗?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务