小红书校招内推:https://www.nowcoder.com/discuss/301211?type=all&order=time&pos=&page=2

0 点赞 评论 收藏
分享
0 点赞 评论 收藏
分享
飞人~:华为三个面试一共大概多长时间呢
0 点赞 评论 收藏
分享

0 点赞 评论 收藏
分享
肖战:我也没收到,自闭了

0 点赞 评论 收藏
分享
2019-09-13 08:42
北京理工大学 C++ 0 点赞 评论 收藏
分享
cyxY:恭喜恭喜 沾沾喜气
0 点赞 评论 收藏
分享
路过的一只NCRer:第一题一样 public static void main(String[] args){
Scanner in = new Scanner(System.in);
String[] A = in.nextLine().split(" ");
String[] B = in.nextLine().split(" ");
int target = in.nextInt();
int[] sons = new int[A.length];
int[] parents = new int[B.length];
for (int i=0;i<A.length;i++){
sons[i] = Integer.valueOf(A[i]);
parents[i] = Integer.valueOf(B[i]);
}
Queue<Integer> queue = new LinkedList<>();
queue.offer(target);
int sum = 0;
while (!queue.isEmpty()){
int par = queue.poll();
for (int i=0;i<parents.length;i++){
if (parents[i] == par){
queue.offer(sons[i]);
sum++;
}
}
}
if (sum == 0) {
for (int i=0;i<sons.length;i++){
if (sons[i] == target){
sum++;
}
}
System.out.println(sum);
} else {
System.out.println(sum + 1);
}
}

0 点赞 评论 收藏
分享

0 点赞 评论 收藏
分享
&70:楼主好棒呀,我二面结束他跟我说今天的面试就到这里。。。。

0 点赞 评论 收藏
分享
超越姐姐保佑:同成都,收到了现场面电话

0 点赞 评论 收藏
分享
2019-09-04 15:34
北京理工大学 C++ 0 点赞 评论 收藏
分享

0 点赞 评论 收藏
分享
创作者周榜
更多
关注他的用户也关注了: