要回国了,写个简单的总结吧。

一亩三分地论坛

 找回密码
 Sign Up 注册获取更多干货
码农求职神器Triplebyte:
不用海投
内推多家公司面试
坐标湾区
Games Startup
招聘游戏开发工程师
游戏初创公司招聘工程师、UIUX Designer和游戏策划
把贵司招聘信息放这里
查看: 1175|回复: 2
收起左侧

Whitepage SDE 面试

[复制链接] |试试Instant~ |关注本帖
suod 发表于 2015-4-14 05:40:58 | 显示全部楼层 |阅读模式

2015(1-3月) 码农类General 硕士 全职@whitepage - 猎头 - 在线笔试  | Other | 其他

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

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

x


You are given an array of integers with values greater than or equal to 0, for example:
[5, 6, 0, 4, 2, 4, 1, 0, 0, 4]
You will develop and implement an algorithm to traverse the array in the shortest number of “hops” starting at index 0, where traversal is defined as follows:
  • Start at the first (0th) index of the array, look at the array value there, and you can hop forward to any array index that is no farther than that value away. So in this example, you start at index 0 containing the value 5 and can now consider hopping to any of indices 1 through 5 inclusive.
  • If you choose to hop to index 3, it contains the value 4 and you can next hop up to 4 more spots from your current index (3)—so you now consider indices 4 through 7 as next steps in your sequence.
  • Once you can legally hop beyond the last array element, you have successfully traversed the array.
Your job is to compute the minimum-length sequence of hops that successfully traverses the array starting from index 0, or determine that there is no such sequence.
Your algorithm must identify a minimum-hops solution, but can choose arbitrarily among solutions with the same number of hops.
Your program will implement the algorithm and write a solution to the standard output stream on a single line identifying the array indices that comprise a solution path, with the indices separated by commas.
For this example, the following would be valid output:
0, 5, 9, out
(Note that your output is a sequence of array indices, not a sequence of hop lengths.)
  • Your program may be written in the language of your choice.
  • It must accept a single command-line argument, which is the path to a file containing the input data (the array of integers). Your program must not read that path from STDIN or the console.
  • The input file will contain the array for a single problem.
    • One integer per line, with no brackets or commas.
    • The input array will likely be large in our testing, so performance is important.
  • If there is no solution, the program should write the string “failure” to the standard output stream, followed by a newline character..留学论坛-一亩-三分地
. 留学申请论坛-一亩三分地

上一篇:FB实习 第二轮电面
下一篇:刚刚结束的liveramp第二轮面经
limingli1991 发表于 2015-4-14 06:38:58 | 显示全部楼层
Thank you !    Where did you apply?  Refer or apply online?
回复 支持 反对

使用道具 举报

王者无敌Alex 发表于 2015-5-1 23:03:04 | 显示全部楼层
楼主后来面的如何?
回复 支持 反对

使用道具 举报

本版积分规则

提醒:发帖可以选择内容隐藏,部分板块支持匿名发帖。请认真读完以下全部说明:

■隐藏内容方法: [hide=200]你想要隐藏的内容比如面经[/hide]
■意思是:用户积分低于200则看不到被隐藏的内容
■可以自行设置积分值,不建议太高(200以上太多人看不到),也不建议太低(那就没必要隐藏了)
■建议只隐藏关键内容,比如具体的面试题目、涉及隐私的信息,大部分内容没必要隐藏。
■微信/QQ/电子邮件等,为防止将来被骚扰甚至人肉,以论坛私信方式发给对方最安全。
■匿名发帖的板块和方法:http://www.1point3acres.com/bbs/thread-405991-1-1.html

关闭

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

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

custom counter

GMT+8, 2018-5-27 11:35

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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