一亩三分地论坛

 找回密码
 获取更多干货,去instant注册!

扫码关注一亩三分地公众号
查看: 884|回复: 2
收起左侧

Amazon SDE Online Assessment 一道题

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

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

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

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

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的遍历吧?。。。。
回复 支持 反对

使用道具 举报

本版积分规则

请点这里访问我们的新网站:一亩三分地Instant.

Instant搜索更强大,不扣积分,内容组织的更好更整洁!目前仍在beta版本,努力完善中!反馈请点这里

关闭

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

手机版|小黑屋|一亩三分地论坛声明 ( 沪ICP备11015994号 )

custom counter

GMT+8, 2016-12-3 23:43

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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