拼多多笔试编程

	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

相关推荐

2025-12-14 11:43
黑龙江大学 Java
用微笑面对困难:确实比较烂,可以这么修改:加上大学的qs排名,然后大学简介要写一些,然后硕士大学加大加粗,科研经历第一句话都写上在复旦大学时,主要负责xxxx,简历左上角把学校logo写上,建议用复旦大学的简历模板
点赞 评论 收藏
分享
2025-12-16 12:46
河北农业大学 Java
king327:最好要在简历中很好地包装和证明你的能力 要证明你的技术深度才能在面试官那里有竞争力 如果你有需要的话可以看一下我主页简历我帮你详细地说一下各个地方的具体问题
实习简历求拷打
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务