一亩三分地论坛

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

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

Zenefits 三轮skype面

[复制链接] |试试Instant~ |关注本帖
hotIce 发表于 2015-4-8 07:28:01 | 显示全部楼层 |阅读模式

2015(4-6月) 码农类 硕士 全职@Zenefits - 内推 - 技术电面 Onsite |Failfresh grad应届毕业生

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

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

x
我也发个上周zenefits的面经吧 已经挂了
三轮skype技术面, 一轮和manager聊天, 说是相当于onsite. Waral 鍗氬鏈夋洿澶氭枃绔,

第一轮两个题目:
(1)You are given an array a of sizeN. The elements of the array area[0], a[1], ... a[N - 1], where each a is either 0 or 1. You can perform one transformation on the array: choose any two integers L,and R, and flip all the elements between (and including) the Lth and Rth bits. In other words, L and R represent the left-most and the right-most index demarcating the boundaries of the segment whose bits you will decided to flip. ('Flipping' a bit means, that a 0 is transformed to a 1 and a 1 is transformed to a 0.)

What is the maximum number of '1'-bits (indicated by S) which you can obtain in the final bit-string?
. 鍥磋鎴戜滑@1point 3 acres
Input Format:
The first line has a single integerN
The next N lines contains the Nelements in the array,a[0], a[1], ... a[N - 1], one per line.
Note: Feel free to re-use the input-output code stubs provided.
. From 1point 3acres bbs
Output format:
Return a single integer that denotes the maximum number of 1-bits which can be obtained in the final bit string

Constraints:
1 ≤ N ≤ 100,000
d can be either 0 or 1. It cannot be any other integer.
0 ≤ L ≤ R < N

Sample Input:
810010010
. From 1point 3acres bbs
Sample Output:
6

Explanation:
We can get a maximum of 6 ones in the given binary array by performing either of the following operations:
Flip [1, 5] ⇒ 1 1 1 0 1 1 1 0
or . from: 1point3acres.com/bbs
Flip [1, 7] ⇒ 1 1 1 0 1 1 0 1
-google 1point3acres
(2)Given N unique positive integers, we want to count the total pairs of numbers whose difference is K. The solution should minimize computational time complexity to the best of your ability

Input Format:
1st line contains N and K, which are integers separated by a space.. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
2nd line contains N integers that form the set.

Constraints
0 ≤ N ≤ 105,
All N numbers are distinct and can be represented by 32 bit signed integer.
0 <K <= 109

Output Format:
One integer, the number of pairs of numbers that have differenceK.

Sample Input #1:
5 21 5 3 4 2

Sample Output #1:

3

Explanation:
The possible pairs are (5,3), (4,2) and (3,1).

.鏈枃鍘熷垱鑷1point3acres璁哄潧
Sample Input #2:

10 1363374326 364147530 61825163 1073065718 1281246024 1399469912 428047635 491595254 879792181 1069262793
Sample Output #2:

0
Explanation:
There are no pairs with a difference of 1.
Read input from STDIN and write output to STDOUT.
.鐣欏璁哄潧-涓浜-涓夊垎鍦
2.


第二轮闲扯了一堆, 只有一个题目:.鐣欏璁哄潧-涓浜-涓夊垎鍦
You are given a square map whose sides are n in length. Each of the n x n cells in the has a value denoting the average depth in its area. A cell is called a cavity if and only if each cell adjacent to it has strictly smaller depth, and the cell is not on the border of the map. Two cells are adjacent if they have a common side.
You need to find all the cavities on the map and depict them with character X.

Input Format
The first line contains an integern (1 < n < 100) denoting the size of the map. Each of the followingn lines contains n digits without spaces. A digit (1-9) denotes the depth of the corresponding area.

Output Format
Output n lines, echoing the input with no spaces between the digits, but substituting the character X for the depth of each cell that you determine to be a cavity.

Sample Input
41112191218921234
Sample Output
11121X1218X21234

第三轮是个三哥, 迟到30分钟, 还来了一个让我很头疼的design问题, 回答的磕磕绊绊, 很可能挂在这一轮:. Waral 鍗氬鏈夋洿澶氭枃绔,

[size=12.8000001907349px]Our app is about showing interesting people around a location. Interesting people are those who share a lot of friends and interests with you.

[size=12.8000001907349px]Input:
[size=12.8000001907349px]N -- number of commands. Followed by N lines, each of the format:
[size=12.8000001907349px]Op args

[size=12.8000001907349px]Op can either be ‘Q’ or ‘W’.
[size=12.8000001907349px]Q is a query operation which takes two args:
[size=12.8000001907349px]user_id miles

[size=12.8000001907349px]miles is always one of the 3 values: 1, 5 or 30.

[size=12.8000001907349px]W is the insertion operation, which takes args of the form:
[size=12.8000001907349px]user_id lat lng interest_id1 weight1 interest_id2 weight2 ...

[size=12.8000001907349px]interest_ids are the set of all interests that user cares about. This could be his facebook friends or interests, each of them having a specific weight.

[size=12.8000001907349px]Output:

[size=12.8000001907349px]For each query operation, output a single line containing the top 10 (or less) user_id’s who are within the ‘miles’ radius of the user and have the highest scalar product of common interest weights. These must be sorted in the order of the weights highest to lowest, tie broken by user_id lowest to highest.

[size=12.8000001907349px]Constraints:

[size=12.8000001907349px]This is more of a real-life problem, than a programming contest puzzle. So the test-case will reflect practically what happens in our software, and not hand-generated corner cases.

[size=12.8000001907349px]Test case will have one densely populated university (stanford) - 500 people, one city (Bay Area) - 50K people, and one sparsely populated country (US) - 500K people.

[size=12.8000001907349px]Each person has on average 5K interest_ids, which is a random number between 1 and 10K (interest_ids are not necessarily numbered 1 to 10K). Number of people who have a specific interest_id tends to follow power law distribution, with 20% of interests having 80% of user_ids, recursively.

. from: 1point3acres.com/bbs
[size=12.8000001907349px]Scoring: It’s a function of:
[size=12.8000001907349px]- Time taken for the program to run.
[size=12.8000001907349px]- Number of words of code. Therefore obfuscation doesn’t help much, you can gladly give large variable names. The idea is to keep the logic extremely simple.
[size=12.8000001907349px]
[size=12.8000001907349px]
[size=12.8000001907349px]

评分

4

查看全部评分

 楼主| hotIce 发表于 2015-4-8 07:29:14 | 显示全部楼层
重贴一下第三题

.鐣欏璁哄潧-涓浜-涓夊垎鍦Our app is about showing interesting people around a location. Interesting people are those who share a lot of friends and interests with you.

Input:
N -- number of commands. Followed by N lines, each of the format:
Op args
. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
Op can either be ‘Q’ or ‘W’..鏈枃鍘熷垱鑷1point3acres璁哄潧
Q is a query operation which takes two args:
user_id miles

miles is always one of the 3 values: 1, 5 or 30..1point3acres缃

W is the insertion operation, which takes args of the form:
user_id lat lng interest_id1 weight1 interest_id2 weight2 ...
. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
interest_ids are the set of all interests that user cares about. This could be his facebook friends or interests, each of them having a specific weight.

Output:

For each query operation, output a single line containing the top 10 (or less) user_id’s who are within the ‘miles’ radius of the user and have the highest scalar product of common interest weights. These must be sorted in the order of the weights highest to lowest, tie broken by user_id lowest to highest.

Constraints:

This is more of a real-life problem, than a programming contest puzzle. So the test-case will reflect practically what happens in our software, and not hand-generated corner cases.

Test case will have one densely populated university (Stanford) - 500 people, one city (Bay Area) - 50K people, and one sparsely populated country (US) - 500K people.

Each person has on average 5K interest_ids, which is a random number between 1 and 10K (interest_ids are not necessarily numbered 1 to 10K). Number of people who have a specific interest_id tends to follow power law distribution, with 20% of interests having 80% of user_ids, recursively.
. 1point 3acres 璁哄潧

Scoring: It’s a function of:
- Time taken for the program to run.
- Number of words of code. Therefore obfuscation doesn’t help much, you can gladly give large variable names. The idea is to keep the logic extremely simple.
回复 支持 反对

使用道具 举报

YY大帝 发表于 2015-4-8 07:33:45 | 显示全部楼层
感谢分享,请问lz之前是几轮店面
回复 支持 反对

使用道具 举报

 楼主| hotIce 发表于 2015-4-8 07:36:56 | 显示全部楼层
YY大帝 发表于 2015-4-8 07:33
感谢分享,请问lz之前是几轮店面

之前只有个Zen Test 3, 然后就店面了
回复 支持 反对

使用道具 举报

nibuxing 发表于 2015-4-8 07:53:17 | 显示全部楼层
为啥有的人是三轮有的人是一轮啊
回复 支持 反对

使用道具 举报

bobzhang2004 发表于 2015-4-8 07:54:54 | 显示全部楼层
这个公司不知道实习怎么样,感觉好多面试
回复 支持 反对

使用道具 举报

 楼主| hotIce 发表于 2015-4-8 10:31:53 | 显示全部楼层
nibuxing 发表于 2015-4-8 07:53
为啥有的人是三轮有的人是一轮啊
. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
我也不清楚 三轮估计就相当于onsite了
回复 支持 反对

使用道具 举报

 楼主| hotIce 发表于 2015-4-8 10:32:14 | 显示全部楼层
bobzhang2004 发表于 2015-4-8 07:54
这个公司不知道实习怎么样,感觉好多面试

据说是2014最hot 的startup
回复 支持 反对

使用道具 举报

sijiyuren 发表于 2015-4-8 10:50:33 | 显示全部楼层
楼主是三轮一天内面完的?
回复 支持 反对

使用道具 举报

 楼主| hotIce 发表于 2015-4-8 10:51:57 | 显示全部楼层
sijiyuren 发表于 2015-4-8 10:50
楼主是三轮一天内面完的?
. Waral 鍗氬鏈夋洿澶氭枃绔,
恩 三轮挨着 背靠背 面完三轮后funder打电话聊了10来分钟
回复 支持 反对

使用道具 举报

faye_roll 发表于 2015-4-8 12:32:36 | 显示全部楼层
LZ他家通知你的时候就是说3轮么?
回复 支持 反对

使用道具 举报

 楼主| hotIce 发表于 2015-4-8 12:34:31 | 显示全部楼层
faye_roll 发表于 2015-4-8 12:32
LZ他家通知你的时候就是说3轮么?

恩 是的 邮件里就通知了
回复 支持 反对

使用道具 举报

nathanwong 发表于 2015-4-8 13:14:47 | 显示全部楼层
nibuxing 发表于 2015-4-8 07:53
为啥有的人是三轮有的人是一轮啊

啥意思?有的人是一轮店面?然后给offer? 有的人是三轮店面给offer?
回复 支持 反对

使用道具 举报

faye_roll 发表于 2015-4-8 21:38:08 | 显示全部楼层
nathanwong 发表于 2015-4-8 13:14. 鍥磋鎴戜滑@1point 3 acres
啥意思?有的人是一轮店面?然后给offer? 有的人是三轮店面给offer?

是指做完OA后,有人直接三轮相当于onsite了吧,有人是一轮电面,然后再onsite或者接着电面
回复 支持 反对

使用道具 举报

 楼主| hotIce 发表于 2015-4-9 00:36:18 | 显示全部楼层
faye_roll 发表于 2015-4-8 21:38. from: 1point3acres.com/bbs
是指做完OA后,有人直接三轮相当于onsite了吧,有人是一轮电面,然后再onsite或者接着电面
. From 1point 3acres bbs
是的 就是这个意思
回复 支持 反对

使用道具 举报

applepie11 发表于 2015-4-9 01:10:36 | 显示全部楼层
楼主之前还有电面吗
回复 支持 反对

使用道具 举报

 楼主| hotIce 发表于 2015-4-9 01:12:35 | 显示全部楼层
applepie11 发表于 2015-4-9 01:10
楼主之前还有电面吗
-google 1point3acres
没有 就一个OA
回复 支持 反对

使用道具 举报

nathanwong 发表于 2015-4-9 01:49:11 | 显示全部楼层
hotIce 发表于 2015-4-9 00:36. Waral 鍗氬鏈夋洿澶氭枃绔,
是的 就是这个意思
. 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴
那是因为lz oa表现很牛的原因吧。若的话 先一轮店面 然后接着onsite 再电。加油
回复 支持 反对

使用道具 举报

57656929bb 发表于 2015-4-9 01:55:47 | 显示全部楼层
第三题没弄明白,楼主当时怎么答得啊
回复 支持 反对

使用道具 举报

 楼主| hotIce 发表于 2015-4-9 02:01:52 | 显示全部楼层
57656929bb 发表于 2015-4-9 01:55
第三题没弄明白,楼主当时怎么答得啊
.鏈枃鍘熷垱鑷1point3acres璁哄潧
这个题我回答的不好 最后折腾出来的答案用的数据结构如下:
unordered_map<pair<int, int>, unordered_set<int> > coordMap;
unordered_map<int, unordered_set<int> > intersetMap;

大致思路就是分别根据coordinate和interest vector 的范围对users分类, 来减少不必要的查询.
回复 支持 反对

使用道具 举报

本版积分规则

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

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

关闭

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

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

custom counter

GMT+8, 2016-12-9 18:29

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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