w******l 发帖数: 58 | 1 一共50min,interview是个印度人, 不太习惯口音, 老让他重复.... 大概记得下面这些
题目
1. introduce yourself, talk about research, why amazon?
2. an array contain integers, all but one integer occurs even times, how to
find the one that occurs odd times?
3. IMDB database, given two random actors, how to find the shortest degree o
f seperation between them? (if A and B are in the same movie, then deg(A,B)=
0,
if A and B are in the same movie, B and C are in the same movie, then deg(A,
C)=1)
4. a stream of numbers with unknown si |
b******v 发帖数: 1493 | 2 多谢共享
50分钟答了这么多题,每道题只要说大致思想就行了吗? |
c**********n 发帖数: 516 | 3 bless , thank you for sharing
to
o
uni
local
【在 w******l 的大作中提到】 : 一共50min,interview是个印度人, 不太习惯口音, 老让他重复.... 大概记得下面这些 : 题目 : 1. introduce yourself, talk about research, why amazon? : 2. an array contain integers, all but one integer occurs even times, how to : find the one that occurs odd times? : 3. IMDB database, given two random actors, how to find the shortest degree o : f seperation between them? (if A and B are in the same movie, then deg(A,B)= : 0, : if A and B are in the same movie, B and C are in the same movie, then deg(A, : C)=1)
|
s*****l 发帖数: 45 | 4 多谢分享,我听Amazon的朋友说take home的 coding question是好迹象,
不用担心,他们也不是一定要求你一定要在一个小时内做完,make it correct and
work是最重要的。
第八个感觉是该用grep返回所有result,然后在trim,保留Top 4.
不太明白这题什么意思,大侠能再补充说说么?
3. IMDB database, given two random actors, how to find the shortest degree
of seperation between them? |
b******v 发帖数: 1493 | 5 第8题我想到的方法是
grep '[0-9]*' test.htm | head -4
不过这样把数字所在行的所有内容都打印出来了
得想办法只打出数字 |
w******l 发帖数: 58 | 6 差不多, 说说用的数据结构, 算法. 因为没有让当场写code,所以比较快
【在 b******v 的大作中提到】 : 多谢共享 : 50分钟答了这么多题,每道题只要说大致思想就行了吗?
|
b******v 发帖数: 1493 | 7 这样改进一下可以只得到数字:
grep '[0-9*]' test.htm | head -4 | sed 's/[^0-9]/ /g'
不过会得到超过4个数字,但是头4个数字肯定在里面
【在 b******v 的大作中提到】 : 第8题我想到的方法是 : grep '[0-9]*' test.htm | head -4 : 不过这样把数字所在行的所有内容都打印出来了 : 得想办法只打出数字
|
w******p 发帖数: 166 | 8 With this input file:
$ cat abcd
asdf asd i6f 121 asd
45 6a asv
a7 12 8 7
First 4 numbers:
$ cat abcd | tr "[[:space:]]" "\n" | grep "\<[[:digit:]]*\>" | head -4
121
45
12
8
First 4 digits:
$ cat abcd | sed -e :a -e '$!N;{s/[^0-9]//g;s/\n//;ta}' | sed -e '{s/^\(.\{4
\}\).*/\1/}'
6121 |
b******v 发帖数: 1493 | 9 学习了,多谢!
{4
【在 w******p 的大作中提到】 : With this input file: : $ cat abcd : asdf asd i6f 121 asd : 45 6a asv : a7 12 8 7 : First 4 numbers: : $ cat abcd | tr "[[:space:]]" "\n" | grep "\<[[:digit:]]*\>" | head -4 : 121 : 45 : 12
|
g*****t 发帖数: 42 | 10 请教第4题怎么答?
a stream of numbers with unknown size, how to choose each number each uni
form probability |
|
|
h****r 发帖数: 2056 | 11 For the first 4 numbers, there is a simple way,
$cat abcd | tr -s " " "\n" | egrep '^[0-9 ]*$' | head -4
【在 w******p 的大作中提到】 : With this input file: : $ cat abcd : asdf asd i6f 121 asd : 45 6a asv : a7 12 8 7 : First 4 numbers: : $ cat abcd | tr "[[:space:]]" "\n" | grep "\<[[:digit:]]*\>" | head -4 : 121 : 45 : 12
|
w******1 发帖数: 520 | |
h****r 发帖数: 2056 | 13 2考的是XOR。
【在 w******1 的大作中提到】 : 2 : 3 题目我都没看懂,。。。。
|
o***e 发帖数: 497 | 14 这个好像有问题哦
【在 h****r 的大作中提到】 : For the first 4 numbers, there is a simple way, : $cat abcd | tr -s " " "\n" | egrep '^[0-9 ]*$' | head -4
|
h****r 发帖数: 2056 | 15 What problem?
【在 o***e 的大作中提到】 : 这个好像有问题哦
|
o***e 发帖数: 497 | 16 你把你的test文件开头加上些空格再试试
【在 h****r 的大作中提到】 : What problem?
|
h****r 发帖数: 2056 | 17 cat abcd | sed -e 's/^ *//' | tr -s ' ' '\n' | egrep '^[0-9]*$'
【在 o***e 的大作中提到】 : 你把你的test文件开头加上些空格再试试
|
t**n 发帖数: 272 | 18 reservoir sampling
第一个数1/1几率留下来,第二个数1/2几率替换留下来的数,第三个1/3几率替换...
【在 g*****t 的大作中提到】 : 请教第4题怎么答? : a stream of numbers with unknown size, how to choose each number each uni : form probability
|