a******u 发帖数: 66 | 1 It has to be the shortest interview that I've ever had, or will have.
tech头说他是被抓来问的,但是他知道我不是programing背景,就问我用什么编程,什
么语言,research用编程么(不
用),知道用script language么(不知道),知道data base么(不知道)。整个过程
很轻松,人很nice。就说要把决定
权给第一轮面我的FE leader。总共过程15分钟不到。
明天hr的人会给我答复,不知道是不是凶多吉少...
Anyway, 借贴问几个最近见到的题目:
1. Reorder a linked list in the order returned by a function. The function
is passed as a function pointer.
(不是很清楚题目的意思。。。)
2。How to change a pair of die so as to create the same probability for
every sum(印象中板上出现过这个题目,
不过找不到了。。)
3。Write a program to reverse the linked list.
(不担心空间和效率的话就直接放到大的vector里面然后逆序吧?)
4。Write an algorithm that reads through a file line by line, then prints
out a random line. It has to print each
line with equal probability. The catch is that you don't know how many lines
the file has ahead of time and you
can only make one pass over the file.
(也见过这个题目,不知道怎么做)
谢谢大家!不好意思这个面经很水。。。。。。。。。 | Y***e 发帖数: 1030 | 2 我还有过7分钟的interview呢
【在 a******u 的大作中提到】 : It has to be the shortest interview that I've ever had, or will have. : tech头说他是被抓来问的,但是他知道我不是programing背景,就问我用什么编程,什 : 么语言,research用编程么(不 : 用),知道用script language么(不知道),知道data base么(不知道)。整个过程 : 很轻松,人很nice。就说要把决定 : 权给第一轮面我的FE leader。总共过程15分钟不到。 : 明天hr的人会给我答复,不知道是不是凶多吉少... : Anyway, 借贴问几个最近见到的题目: : 1. Reorder a linked list in the order returned by a function. The function : is passed as a function pointer.
| Y******u 发帖数: 1912 | 3 2. is that possible? there are 36 combination and 11 numbers. Won't be even
distributed
3. use 3 pointer to reverse it in place | p*b 发帖数: 30 | 4 2. change one die so that it output some value with probability 1... don't
know if this counts as a solution
3. use 3 pointers to make it in one run
4. readin one line, keep it
readin the 2nd line, flip a fair coin, if head, keep the original line,
if tail, keep the new readin line
readin the 3rd line, flip a 2/3 coin, if head, keep the original line, if
tail, keep the new readin line
... (continue the procedure by fliping a 3/4, 4/5, ... coin)
【在 a******u 的大作中提到】 : It has to be the shortest interview that I've ever had, or will have. : tech头说他是被抓来问的,但是他知道我不是programing背景,就问我用什么编程,什 : 么语言,research用编程么(不 : 用),知道用script language么(不知道),知道data base么(不知道)。整个过程 : 很轻松,人很nice。就说要把决定 : 权给第一轮面我的FE leader。总共过程15分钟不到。 : 明天hr的人会给我答复,不知道是不是凶多吉少... : Anyway, 借贴问几个最近见到的题目: : 1. Reorder a linked list in the order returned by a function. The function : is passed as a function pointer.
| Y******u 发帖数: 1912 | 5 Your solution 4 doesn't work. I wrote a program to test.
if
【在 p*b 的大作中提到】 : 2. change one die so that it output some value with probability 1... don't : know if this counts as a solution : 3. use 3 pointers to make it in one run : 4. readin one line, keep it : readin the 2nd line, flip a fair coin, if head, keep the original line, : if tail, keep the new readin line : readin the 3rd line, flip a 2/3 coin, if head, keep the original line, if : tail, keep the new readin line : ... (continue the procedure by fliping a 3/4, 4/5, ... coin)
| p*b 发帖数: 30 | 6 why not?
the probability of outputing line 1 would be 1/2 * 2/3 * 3/4 *...*(N-1)/N =
1/N
the probability of outputing line 2 would be the same as above.
the probability of outputing line 3 would be 1/3 * 3/4 *...*(N-1)/N = 1/N
....
the probability of outputing line k would be 1/k * k/(k+1)*...*(N-1)/N = 1/N
...
【在 Y******u 的大作中提到】 : Your solution 4 doesn't work. I wrote a program to test. : : if
| a******u 发帖数: 66 | 7 how did it turn out?
【在 Y***e 的大作中提到】 : 我还有过7分钟的interview呢
| a******u 发帖数: 66 | 8 thanks! It works!
if
【在 p*b 的大作中提到】 : 2. change one die so that it output some value with probability 1... don't : know if this counts as a solution : 3. use 3 pointers to make it in one run : 4. readin one line, keep it : readin the 2nd line, flip a fair coin, if head, keep the original line, : if tail, keep the new readin line : readin the 3rd line, flip a 2/3 coin, if head, keep the original line, if : tail, keep the new readin line : ... (continue the procedure by fliping a 3/4, 4/5, ... coin)
| Y******u 发帖数: 1912 | 9 sry, made a mistake in algo. It works
=
/N
【在 p*b 的大作中提到】 : why not? : the probability of outputing line 1 would be 1/2 * 2/3 * 3/4 *...*(N-1)/N = : 1/N : the probability of outputing line 2 would be the same as above. : the probability of outputing line 3 would be 1/3 * 3/4 *...*(N-1)/N = 1/N : .... : the probability of outputing line k would be 1/k * k/(k+1)*...*(N-1)/N = 1/N : ...
|
|