传说中的谷歌招聘委员会成员之一,从幕后走出来,教你学系统设计!


一亩三分地论坛

 找回密码
 获取更多干活,快来注册
Babeltime游戏工作室招工程师、美术和策划
Tubi TV招安卓、前端和机器学习工程师
把贵司招聘信息放这里
查看: 1454|回复: 0
收起左侧

Twitter OA

[复制链接] |试试Instant~ |关注本帖
tyang12 发表于 2016-4-29 02:06:02 | 显示全部楼层 |阅读模式

2016(1-3月) 码农类 硕士 全职@Twitter - 校园招聘会 - 在线笔试 |Otherfresh grad应届毕业生

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

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

x
突然发现上个月的作的twitter OA还没发,一样是60mins 两题,
第一题:
Input format:
N        // count of number in the input
d[0]        //1st number
d[1]        //2nd number
...
d[n-1]        //last number. From 1point 3acres bbs


Output format:
The first line contains a string of n bits, where the i-th bit (as read from left to right) indicates if there is any number before b which is equal to b.
The second line contains a string of n bits, where the i-th bit (as read from left to right) indicates if there is any number after b which is equal to b.

Sample input:
6        //total 6 numbers given below. From 1point 3acres bbs
1
3
2
3
4
1

Sample output:
000101. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
110000


这题我在做之前看地里其他帖子分享过,我是用HashSet来做. From 1point 3acres bbs
-google 1point3acres
第二題:
Return the count of numbers X in the range 1<=X<=N that satisfy the following property:
(X-1) !  % X = X-1.鏈枃鍘熷垱鑷1point3acres璁哄潧

Input Parameter:
A single integer N. visit 1point3acres.com for more.

Constraints:-google 1point3acres
1 <= N <= 10^5. 1point3acres.com/bbs

Output Format:
A single integer which in the count of the numbers that satisfy the above property.

Sample Input:. 鍥磋鎴戜滑@1point 3 acres
2
Sample Output:
2

Sample Input:
4
Sample Output:
3. 鍥磋鎴戜滑@1point 3 acres

这题我作之前没看过,所以一看到有点慌,我列了N= 1~7的结果后,猜测就是在找prime number (时间不够,没想到怎么证明...),幸运通过所有test cases,
------------------------------------------------------------------------

. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴做完后跟地里大家一样填了pre-interview questions,直到4/14才收到信,说这周五前会有消息,等了好久,希望这两天能得到下一步面试啊!!! !

评分

1

查看全部评分

本帖被以下淘专辑推荐:

本版积分规则

关闭

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

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

custom counter

GMT+8, 2017-9-22 03:48

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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