b******b 发帖数: 713 | 1 面了google/facebook/linkedin/two sigma/aqr/uber, 被uber/aqr据了。基本所有面
过的题:
hedge fund 1:
1. Write a function that takes as input integers P and Q and returns P to
the power of Q. Note any assumptions you make and the complexity of the
algorithm. We expect you to do better than O(Q).
2. Write a function that takes as input an array of 1 million integers,
such that 1 ≤ x ≤ 10 for every element x in the array, and returns the
sorted array. The sort does not need to occur in-place. Obviously you can
just call a standard sorting function like quicksort, but can you do better?
3. You are given an alphanumeric string. Write an algorithm that will
segment the string into substrings of consecutive integers or numbers and
then sort the substrings. For example, the string “AZQF013452BAB” will
result in “AFQZ012345ABB”.
4. Write a function to determine the largest palindromic subsequence of a
string. A palindromic string is a string which is the same when read in
either the forward or reverse direction. For example, “ABBA” is a
palindromic string and the largest palindromic substring of “TABBA” is “
ABBA”.
I did with a double loop solution.
tech company 1:
phone screen:
word ladder (check the leetcode for this question)
onsite:
1. graph deepcopy
2. use normal lock to implement readwrite lock
3. design question, how to scale web application
4. given a list of iterators which iterates over sorted lists, write a
MergeIterator class which iterates over the merged list, e.g.
class MergeIterator>
{
MergeIterator(List> iterators)
{
}
boolean hasNext()
T next();
}
hedge fund 2:
1. friend circles - give a matrix, Y in cell means i and j is friend, N
otherwise, find how many friend circles in the matrix, e.g. 1 is friend of 2
, and 2 is friend of 3, then 1,2,3 is in same friend circle.
2. StringChain, give a dictionary, the string chain is by remove a char in
the string, and if the new string is in the dictionary, then continue, e.g.
dict = { a, b, ab, abc, add} then the longest chain is (a, ab, abc) or (b,
ab, abc). The char can be removed from any place in the string.
online coding:
huffman decoding. give a huffman encoding dictionary, decode a string back.
Onsite:
1. multiply 2 numbers, the digits of the numbers are given as int array, e.g
. int[] product(int[] num1, int[] num2);
2. given a list of intervals, each interval is defined as 2 integer (start/
end), find min set of points, for those points, each interval at least cover
1 point. e.g. given intervals as [1, 4], [2, 3], [5, 6], we just need 2
points, (2, 5), and each interval will either cover piont 2, or point 5.
need O(nlogn) solution.
3. given binary search tree, each tree node contains piont of (left, right,
parent, leftChildTreeSize), write a function to find the number of nodes
which has value less than the given node, e.g.
int findNumberofLess(Node current, Node root);
4. process 2 stream of data and output result, basic merge sort
implementation.
tech company 2:
1. have N offices globally. each office have a local calender with holidays.
you are allowed to move every weekend to different office, how to get max
numbers of holidays. follow up, if for each office, there are only certain
set of offices are reacheable, e.g. if you are in NYC this weekend, you can
move to SF, or London. If you are in SF, you can move to NYC and Beijing,
etc. how to max the holidays.
2. Binary tree find the longest consecutive path.
3. how to check 2 rectangles overlap. Give a very large set of segments (
each segment is defined by start point and end point), given a function
which given 2 segments, returns the intesection of the 2 segment if they
intersect, or null if not. How to find all the intersections, cannot do the
double loop in memory since the dataset is too big to fit in memory.
4. give a string array, find the 2 string which don't share any char, and
have the max product of the lengths. e.g. given string abc, aagh, def, the
max product is len(abc) * len(def) = 3 * 3 = 9
5. design question, how to generate unique sequence number using distributed
system. e.g. you have a set of machines which is running this sequence
number generator, client can connect to any machine, and get the next
sequence number which is guranteed to increment for same client.
tech company 3:
online coding:
1. find kth minimal number in tournament tree. sample of tournament tree (2
beat 4, 3 beat 5, 2 beat 3 and become champion)
2
2 3
4 2, 3, 5
2. word distance, e.g. given an array of words, and give 2 words, find the
min distance of index those 2 words
Onsite:
1. deepIterator, e.g. given list {1, 2, {{3, 5}, 4}, 6}, write an iterator
class which will iterate through the deep list.
2. check whether 2 tree is identical, can you do it iteratively?
3. roman string to int, and int to roman string
4. adding a list of intervals, each interval is defined by start point and
end point, find the total coverage of the intervals, e.g. intervals: { 1, 4}
, {2, 5}, {7, 10}, total coverage is 1 to 5 and 7 to 10, which is 7.
5. design question, design a system which can rank the url sharings, e.g.
users will share urls, we want to rank the most shared urls for the last 10
minutes, for last hour, for last day, etc. there are total 100 millions url
sharing happen every day.
现在two sigma/google 二选一,工资基本一样,组都不错,不知道有没有在那里上班
的可以给点建议。 | l********l 发帖数: 91 | | R******e 发帖数: 94 | 3 恭喜!
选狗还是2sigma已经是月经贴了
看看自己具体对做什么感兴趣吧 | d******v 发帖数: 801 | 4 好久没看到这么详细面经了,楼主啥背景能分享一下吗? | b******b 发帖数: 713 | 5 working in investment banks for 10+ years.
【在 d******v 的大作中提到】 : 好久没看到这么详细面经了,楼主啥背景能分享一下吗?
| p*u 发帖数: 2454 | 6 2S is u want 2 stay in finance, otherwise G
【在 b******b 的大作中提到】 : working in investment banks for 10+ years.
| m******3 发帖数: 346 | 7 多谢楼主
下面这几道题怎么做啊
tech company 2:
1. have N offices globally. each office have a local calender with holidays.
you are allowed to move every weekend to different office, how to get max
numbers of holidays. follow up, if for each office, there are only certain
set of offices are reacheable, e.g. if you are in NYC this weekend, you can
move to SF, or London. If you are in SF, you can move to NYC and Beijing,
etc. how to max the holidays.
2. Binary tree find the longest consecutive path.
[能详细说说题意么?]
3. how to check 2 rectangles overlap. Give a very large set of segments (
each segment is defined by start point and end point), given a function
which given 2 segments, returns the intesection of the 2 segment if they
intersect, or null if not. How to find all the intersections, cannot do the
double loop in memory since the dataset is too big to fit in memory.
4. give a string array, find the 2 string which don't share any char, and
have the max product of the lengths. e.g. given string abc, aagh, def, the
max product is len(abc) * len(def) = 3 * 3 = 9
tech company 3:
online coding:
1. find kth minimal number in tournament tree. sample of tournament tree (2
beat 4, 3 beat 5, 2 beat 3 and become champion)
2
2 3
4 2, 3, 5 | l******s 发帖数: 3045 | 8 谢谢,似乎没有design?
to
can
better?
【在 b******b 的大作中提到】 : 面了google/facebook/linkedin/two sigma/aqr/uber, 被uber/aqr据了。基本所有面 : 过的题: : hedge fund 1: : 1. Write a function that takes as input integers P and Q and returns P to : the power of Q. Note any assumptions you make and the complexity of the : algorithm. We expect you to do better than O(Q). : 2. Write a function that takes as input an array of 1 million integers, : such that 1 ≤ x ≤ 10 for every element x in the array, and returns the : sorted array. The sort does not need to occur in-place. Obviously you can : just call a standard sorting function like quicksort, but can you do better?
| b****r 发帖数: 1272 | 9 2 rec overlap, 能不能用merge interval的思想
先按topleft x sort, find x intervals
再按topleft y sort, find y intervals
但不用merge
然后找x和y交集? O(nlgn)
holidays.
can
【在 m******3 的大作中提到】 : 多谢楼主 : 下面这几道题怎么做啊 : tech company 2: : 1. have N offices globally. each office have a local calender with holidays. : you are allowed to move every weekend to different office, how to get max : numbers of holidays. follow up, if for each office, there are only certain : set of offices are reacheable, e.g. if you are in NYC this weekend, you can : move to SF, or London. If you are in SF, you can move to NYC and Beijing, : etc. how to max the holidays. : 2. Binary tree find the longest consecutive path.
| j**********3 发帖数: 3211 | | | | r*******g 发帖数: 1335 | 11 find kth minimal number in tournament tree
这个minimal number是第k名吗
看起来像toplogicalsort | b******b 发帖数: 713 | 12 tech company 2:
1. 我是用dynamic programming.
2. 假设binary tree (not BST)是:
5
2 6
3 9 3 8
1 4 5
最长的是 (2,3, 4)。其实挺简单的,我是写recursive, 就几行。
3。这个是问怎么把问题分解成小问题so it can be computed on cluster.
4. 挺简单的,就是看有没有好办法快速检查两个string有没有common char,用
bitvector 就好了。
tech company 3:
每个选手的实力就是tree node的数值,所以每个node的值就是它的两个child node中
小的值。我是用了个heap,maybe there are better solution.
holidays.
can
【在 m******3 的大作中提到】 : 多谢楼主 : 下面这几道题怎么做啊 : tech company 2: : 1. have N offices globally. each office have a local calender with holidays. : you are allowed to move every weekend to different office, how to get max : numbers of holidays. follow up, if for each office, there are only certain : set of offices are reacheable, e.g. if you are in NYC this weekend, you can : move to SF, or London. If you are in SF, you can move to NYC and Beijing, : etc. how to max the holidays. : 2. Binary tree find the longest consecutive path.
| b******b 发帖数: 713 | 13 每个tech company 都有一个design 题。hudge fund 没有。
【在 l******s 的大作中提到】 : 谢谢,似乎没有design? : : to : can : better?
| b******b 发帖数: 713 | 14 一个在connecticut的hedge fund。
【在 j**********3 的大作中提到】 : aqr 是什么
| f******x 发帖数: 201 | 15 谢谢楼主!
请问楼主,top url那题怎么做啊?
5. design question, design a system which can rank the url sharings, e.g.
users will share urls, we want to rank the most shared urls for the last 10
minutes, for last hour, for last day, etc. there are total 100 millions url
sharing happen every day.
谢谢!
to
can
better?
【在 b******b 的大作中提到】 : 面了google/facebook/linkedin/two sigma/aqr/uber, 被uber/aqr据了。基本所有面 : 过的题: : hedge fund 1: : 1. Write a function that takes as input integers P and Q and returns P to : the power of Q. Note any assumptions you make and the complexity of the : algorithm. We expect you to do better than O(Q). : 2. Write a function that takes as input an array of 1 million integers, : such that 1 ≤ x ≤ 10 for every element x in the array, and returns the : sorted array. The sort does not need to occur in-place. Obviously you can : just call a standard sorting function like quicksort, but can you do better?
| r*******g 发帖数: 1335 | 16 楼主大牛
没看懂下面这题
tech company 3:
每个选手的实力就是tree node的数值,所以每个node的值就是它的两个child node中
小的值。我是用了个heap,maybe there are better solution.
tournament tree到底长啥样
多谢。
【在 b******b 的大作中提到】 : tech company 2: : 1. 我是用dynamic programming. : 2. 假设binary tree (not BST)是: : 5 : 2 6 : 3 9 3 8 : 1 4 5 : 最长的是 (2,3, 4)。其实挺简单的,我是写recursive, 就几行。 : 3。这个是问怎么把问题分解成小问题so it can be computed on cluster. : 4. 挺简单的,就是看有没有好办法快速检查两个string有没有common char,用
|
|