拼多多笔试编程

	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

相关推荐

不愿透露姓名的神秘牛友
07-07 11:35
程序员小白条:话太多,没实力和学历,差不多回答回答就行了,身份地位不一样
点赞 评论 收藏
分享
06-19 19:06
门头沟学院 Java
码农索隆:别去东软,真学不到东西,真事
点赞 评论 收藏
分享
06-15 20:57
已编辑
门头沟学院 Java
CARLJOSEPH...:年轻人有傲气很正常,但是建议工作前洗净傲气。 说实在的,什么奖学金什么奖项的都很一般。尊重你的老师,在有时间的时候去上课,真遇到走不开的事,请态度端正地向你的老师说明情况,请求请假。我相信任何一个有师德的老师都会允许的(我的老师就是这样)。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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