《数据科学面试40+真题讲解》,K神本年度最后一次开课


一亩三分地论坛

 找回密码
 Sign Up 注册获取更多干货
码农求职神器Triplebyte:
不用海投,内推你去多家公司面试
Airbnb 数据科学职位
in analytics and inference
天天打游戏、照样领工资,
你要不要来?
把贵司招聘信息放这里
查看: 1466|回复: 2
收起左侧

Amazon SDE Online Assessment 一道题

[复制链接] |试试Instant~ |关注本帖
craiglin1992 发表于 2015-8-21 03:14:22 | 显示全部楼层 |阅读模式

2015(7-9月) 码农类 本科 全职@Amazon - 内推 - 在线笔试 |Otherfresh grad应届毕业生

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看,没有帐号?Sign Up 注册获取更多干货

x
一道OA题,在 glassdoor 看到的, 没想出解法(其实是没看懂题目), 各路大神有没有会的? 看着像BFS但看结果好像又不是:Social Graph : In this problem, we want to parse a members social graup on the hot new social network. For the unfamiliar, each member in the network has n-many friends. Each of those friends has n-many more friends an on and on and on. We would like to write a program that given a socal graph, outputs each level of friends. Each friend should only be output once, at the first level they are encountered. The root friend should not be output. Input will consists of serveral lines, where each line represents a member and their friends. The final line will be the student of whom we will begin our traversal. For instance, a member and their friends will be represented as a string: A:B,C,D Where A is the member and B, C and D are the friends of A. If a member is listed without a colon, you can assume they have no friends of their own. Input 4 A:B,C,D B:A,D,E C:E,B A output: B:C,D E

wuqun597090371 发表于 2015-8-21 08:26:51 | 显示全部楼层
这是第二轮的题吗
回复 支持 反对

使用道具 举报

坐看云起 发表于 2015-8-21 18:29:06 | 显示全部楼层
看描述,是一个BFS的遍历吧?。。。。
回复 支持 反对

使用道具 举报

本版积分规则

关闭

一亩三分地推荐上一条 /5 下一条

手机版|小黑屋|一亩三分地论坛声明

custom counter

GMT+8, 2017-11-25 11:57

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

快速回复 返回顶部 返回列表