回复: 7
跳转到指定楼层
上一主题 下一主题
收起左侧

Twitter Online Test

全局:

2014(1-3月) 码农类General 硕士 全职@twitter - 内推 - 在线笔试  | | Other |

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

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
Twitter online test 题目两道 一个小时,题目很简单,代码一道题就是10行吧,感觉像是数学题。1.

A positive integer N is given. The goal is to construct the shortest possible sequence of integers ending with N, using the following rules:
the first element of the sequence is 1; more specifically: A[0] = 1,
each of the following elements is generated by multiplying the previous element by 2 or increasing it by 1; more precisely: A[i] = A[i−1] * 2 or A[i] = A[i−1] + 1, for i ≥ 1.
For example, for N = 17, the shortest sequence is:
  A[0] = 1
  A[1] = 2
  A[2] = 4
  A[3] = 8
  A[4] = 16
  A[5]
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
an integer within the range [−2,147,483,648..2,147,483,647].
Complexity:
expected worst-case time complexity is O(N);
expected worst-case space complexity is O(1), beyond input storage (not counting the storage required for input arguments).
Elements of input arrays can be modified.

评分

参与人数 5大米 +19 收起 理由
jintiandeng + 1 感谢分享!
bradyfang + 3 多谢分享!
weiqitsai + 2 感谢分享!
暗夜思潮 + 3 感谢分享!
kang1415926 + 10 感谢分享!

查看全部评分


上一篇:TripAdvisor online test
下一篇:Epic Online Assesment
🔗
cqx83 2014-2-16 12:37:44 | 只看该作者
全局:
这两道题确实相当easy啊。。。
回复

使用道具 举报

🔗
nealaws 2014-2-16 13:33:07 | 只看该作者
全局:
第一题 原数/2 如果结果不为1 result+1 如果有余数 result+1 最后result+1 O(logn)时间 O(1)空间
第二题 扫描的时候记录奇数偶数的个数 如果遇到奇数 result+奇数的个数 更新奇数的个数 如果遇到偶数 result+偶数的个数 更新偶数的个数  O(N)时间 O(1)空间
回复

使用道具 举报

🔗
 楼主| sumingche 2014-2-17 05:13:33 | 只看该作者
全局:
cqx83 发表于 2014-2-15 23:37
这两道题确实相当easy啊。。。

的确啊 感觉就是数学小题
回复

使用道具 举报

🔗
hmsun77 2014-3-4 08:42:45 | 只看该作者
全局:
感谢楼主分享!楼主电面都面的啥呢?也是正常算法题coding么?
回复

使用道具 举报

🔗
 楼主| sumingche 2014-3-4 08:59:52 | 只看该作者
全局:
hmsun77 发表于 2014-3-3 19:42
感谢楼主分享!楼主电面都面的啥呢?也是正常算法题coding么?

对啊 正常算法题
回复

使用道具 举报

🔗
bradyfang 2014-3-5 22:47:34 | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
回复

使用道具 举报

🔗
bradyfang 2014-3-6 03:13:03 | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

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