l**h 发帖数: 893 | 1 做手机的那个A,希望对同胞们有用。
每次都是两个人一起面,总共五六组,所以总共要见十个还是十二个。记得的问题:
1. Find the lonely celebrity(celebrity: everyone knows him, he knows no one)
. Given a function boolean knows(A, B), which tells you if A knows B.
Implement function: List getLonelyCelebrity(Set names).
2. You got 2^40 positive 4 byte integers on disk, 16M memory, how to find
the first missing integer.
3. Implement the merge of multiple inputs. (I assumed each input implements
hasNext(), next())
4. Reverse a byte array, Reverse a char array (variant length char)
5. A row of hosts, from left to right, find a method to calculate the total
number of hosts. Each host can invoke: isLeft, isRight, sendToLeft,
sendToRight.
6. On cellphone keyboard, each number corresponds to several chars. Given a
list numbers, e.g. 1224668332, find the longest valid word (dict is given).
7. Reverse a list in Java, complexity?
8. design: a remote service+DB to keep top 100 scores for a game. It's a
single player game, and played on mobile device. Requirement: every time an
user starts to play, show the current top 100 scores.
9. design: java process同步的问题, 一堆write process,一开始write process要共
同agree一个数,比如100,那么就产生100个文件。完了之后一堆read process开始,去
consume这些文件。
10. 一个permutation相关的问题,记不得细节了 | b******7 发帖数: 92 | 2 celebrity的题最近很常见啊,
社会名流算法,练习下
vector getLonelyCelebrity(vector names)
{
vector celebrities;
if(names.empty()) return celebrities;
int i = 0, j = names.size()-1;
while(i < j)
{
if(knows(names[i],names[j]))
i++;
else
j--;
}
//check if i-th person is a celebrity
//1.he knows no one
for(int k = 0; k < names.size(); k++)
{
if(k != i && knows(names[i],names[k]))
return celebrities;//
}
//2.everybody knows him
for(int k = 0; k < names.size(); k++)
{
if(k != i && !knows(names[k],names[i]))
return celebrities;
}
celebrities.push_back(names[i]);
return celebrities;
} | r*******e 发帖数: 7583 | 3 既然返回值是vector,celebrity可能不止一个
你的做法是默认一个吧
【在 b******7 的大作中提到】 : celebrity的题最近很常见啊, : 社会名流算法,练习下 : vector getLonelyCelebrity(vector names) : { : vector celebrities; : if(names.empty()) return celebrities; : int i = 0, j = names.size()-1; : while(i < j) : { : if(knows(names[i],names[j]))
| x*******4 发帖数: 5 | 4 如果存在两个celebrity, 就与题目中要求(everyone knows him, he knows no one)
矛盾了
【在 r*******e 的大作中提到】 : 既然返回值是vector,celebrity可能不止一个 : 你的做法是默认一个吧
| r*******e 发帖数: 7583 | 5 是的,默认应该是你这样理解
但是如果celebrity之间的关系不算的话,就不一样
只是觉得题目的返回值用vector有点奇怪
【在 x*******4 的大作中提到】 : 如果存在两个celebrity, 就与题目中要求(everyone knows him, he knows no one) : 矛盾了
| w******j 发帖数: 185 | | b******7 发帖数: 92 | 7 celebrity要么有一个,要么没有。给你这样的返回值可能是考察你是否想到这一点。
【在 r*******e 的大作中提到】 : 是的,默认应该是你这样理解 : 但是如果celebrity之间的关系不算的话,就不一样 : 只是觉得题目的返回值用vector有点奇怪
| l*****a 发帖数: 14598 | 8 这个做手机的A还用java interview?
one)
implements
【在 l**h 的大作中提到】 : 做手机的那个A,希望对同胞们有用。 : 每次都是两个人一起面,总共五六组,所以总共要见十个还是十二个。记得的问题: : 1. Find the lonely celebrity(celebrity: everyone knows him, he knows no one) : . Given a function boolean knows(A, B), which tells you if A knows B. : Implement function: List getLonelyCelebrity(Set names). : 2. You got 2^40 positive 4 byte integers on disk, 16M memory, how to find : the first missing integer. : 3. Implement the merge of multiple inputs. (I assumed each input implements : hasNext(), next()) : 4. Reverse a byte array, Reverse a char array (variant length char)
| c*****a 发帖数: 808 | | l**h 发帖数: 893 | 10 对, 是考点之一。
【在 b******7 的大作中提到】 : celebrity要么有一个,要么没有。给你这样的返回值可能是考察你是否想到这一点。
| | | l**h 发帖数: 893 | 11 他们service那一块的,几乎全是Java.
【在 l*****a 的大作中提到】 : 这个做手机的A还用java interview? : : one) : implements
| c********t 发帖数: 5706 | 12 多谢面经!
你面的时候确认了最多只有一个celebrity吗?
【在 l**h 的大作中提到】 : 对, 是考点之一。
| c********t 发帖数: 5706 | 13 你说的这种情况也不难解决,如果是
celebrity: everyone knows him, he knows only other celebrities
就复杂了。
【在 r*******e 的大作中提到】 : 是的,默认应该是你这样理解 : 但是如果celebrity之间的关系不算的话,就不一样 : 只是觉得题目的返回值用vector有点奇怪
| c********t 发帖数: 5706 | 14 5 能不能再解释一下, 不懂isRight, sendLeft要做什么。
one)
implements
【在 l**h 的大作中提到】 : 做手机的那个A,希望对同胞们有用。 : 每次都是两个人一起面,总共五六组,所以总共要见十个还是十二个。记得的问题: : 1. Find the lonely celebrity(celebrity: everyone knows him, he knows no one) : . Given a function boolean knows(A, B), which tells you if A knows B. : Implement function: List getLonelyCelebrity(Set names). : 2. You got 2^40 positive 4 byte integers on disk, 16M memory, how to find : the first missing integer. : 3. Implement the merge of multiple inputs. (I assumed each input implements : hasNext(), next()) : 4. Reverse a byte array, Reverse a char array (variant length char)
| l**h 发帖数: 893 | 15 对
【在 c********t 的大作中提到】 : 多谢面经! : 你面的时候确认了最多只有一个celebrity吗?
| l**h 发帖数: 893 | 16 isRight: 返回当前host是不是最右边的host
sendLeft: 发送一个消息给左边的host.
最后要通过消息传递来统计总host数
【在 c********t 的大作中提到】 : 5 能不能再解释一下, 不懂isRight, sendLeft要做什么。 : : one) : implements
|
|