Redian新闻
>
发20个包子吧
avatar
发20个包子吧# Living
g*x
1
PHONE 1:
1. how to print a string backward
2. write code to find common elements in two arrays (2 pointers or hashtable)
3. ways to find pairs of elements that has specific sum
4. describe java gc, diff between strong and weak references
5. OOD for hotel reservation sys
6. two servers and one DB, how to improve performance
PHONE 2:
1. write code to find pairs of elements that has specific sum, e.g, 1, 1, 2,
3, 3, sum=4, return {{1, 3}, {1, 3}, {1, 3}, {1, 3}}
2. what if array very huge (millions of TB of elements)
ONSITE
1. replace all "1-800-xxx-xxxx" with "help line" in all .
html files under all subdirectories of a given dir
2. longest increasing consecutive subsequence. e.g. 3, 2, 4, 5, 1, 6. return
{2, 4, 5}
3. if amazon bookstore want to list top authors, how do you define "top"
4. get first pair of numbers in array that sum up to given value, return
their positions, e.g, 1, 1, 2, 4, 4, sum=5, return {0, 3}
5. check if a binary tree is BST
6. diff between HashMap and HashSet
7. implement HashMap
面试后第二天就收到拒信,可是拒信里写说“I will return your resume to the
candidate database where all Amazon.com recruiters and hiring managers may
review your qualifications for other opportunities within Amazon.com”,然后
又听一个在A公司工作的同学说有两种,一种就是直接拒了,还有一种是recycle,就是
放回去如果有人要就不用再从头一关关地面了,可能就跟hiring manager还有bar
raiser面一下。。。不知道有没有童鞋有过挂了以后又被请去第二次onsite的经历?
avatar
A*i
2
嗯,打倒万恶犹太seller.月底closing,到今天才来说要rent back.我们现在的房子是不
可能继续住下去了....
已经做好协商不成打官司的准备了. 只不过真那样的话,要在月底前找到另外的房子住.
大家祝福我吧!
avatar
g*e
3
求和的题目竟然问了三遍...
onsite第一题可以用shell script吗?
bless op

hashtable)
2,
return

【在 g*****x 的大作中提到】
: PHONE 1:
: 1. how to print a string backward
: 2. write code to find common elements in two arrays (2 pointers or hashtable)
: 3. ways to find pairs of elements that has specific sum
: 4. describe java gc, diff between strong and weak references
: 5. OOD for hotel reservation sys
: 6. two servers and one DB, how to improve performance
: PHONE 2:
: 1. write code to find pairs of elements that has specific sum, e.g, 1, 1, 2,
: 3, 3, sum=4, return {{1, 3}, {1, 3}, {1, 3}, {1, 3}}

avatar
n*9
4
how did you sign the contract? possession on closing? how long do they want
to rent back?

住.

【在 A***i 的大作中提到】
: 嗯,打倒万恶犹太seller.月底closing,到今天才来说要rent back.我们现在的房子是不
: 可能继续住下去了....
: 已经做好协商不成打官司的准备了. 只不过真那样的话,要在月底前找到另外的房子住.
: 大家祝福我吧!

avatar
c*l
5
麻烦请把这个解释下么?
4. describe java gc, diff between strong and weak references
谢谢~
bless
avatar
j*u
6
BLESS
avatar
t*8
7
lz是哪天onsite的?

hashtable)
2,

【在 g*****x 的大作中提到】
: PHONE 1:
: 1. how to print a string backward
: 2. write code to find common elements in two arrays (2 pointers or hashtable)
: 3. ways to find pairs of elements that has specific sum
: 4. describe java gc, diff between strong and weak references
: 5. OOD for hotel reservation sys
: 6. two servers and one DB, how to improve performance
: PHONE 2:
: 1. write code to find pairs of elements that has specific sum, e.g, 1, 1, 2,
: 3, 3, sum=4, return {{1, 3}, {1, 3}, {1, 3}, {1, 3}}

avatar
A*i
8
我们sign contract的时候,提过rent back,但是说清楚了需要提前30天的notice.
closing date是28号. 他现在只是提前了15天.他们说想rent back到2月15号.叫我们去
找个临时住处.
lg已经叫律师去信据绝了,一来我们的landlord把我们现在的房子租出去了,二来我也有
了宝宝,不可能折腾.
就是很烦.

want

【在 n*******9 的大作中提到】
: how did you sign the contract? possession on closing? how long do they want
: to rent back?
:
: 住.

avatar
g*e
9
java gc就不用说了吧,把这个link和sun的java memory model白皮书好好看一遍,你
懂的比大部分面试的人还多
http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html
关于strong, soft, weak, phantom reference,下面这个link解释的非常清楚
http://weblogs.java.net/blog/enicholas/archive/2006/05/understa

【在 c*****l 的大作中提到】
: 麻烦请把这个解释下么?
: 4. describe java gc, diff between strong and weak references
: 谢谢~
: bless

avatar
n*9
10
别急,先把实情告诉他们。都是人,没有整不了的。

【在 A***i 的大作中提到】
: 我们sign contract的时候,提过rent back,但是说清楚了需要提前30天的notice.
: closing date是28号. 他现在只是提前了15天.他们说想rent back到2月15号.叫我们去
: 找个临时住处.
: lg已经叫律师去信据绝了,一来我们的landlord把我们现在的房子租出去了,二来我也有
: 了宝宝,不可能折腾.
: 就是很烦.
:
: want

avatar
h*d
11
bless
avatar
H*7
12
先吃再说
avatar
g*x
13
恩,每次问的都有些不同,比方ONSITE那次要返回位置,所以不能SORT
可能本意就是想让我用SHELL SCRIPT写吧,无奈LINUX不熟,就用JAVA了

【在 g**e 的大作中提到】
: 求和的题目竟然问了三遍...
: onsite第一题可以用shell script吗?
: bless op
:
: hashtable)
: 2,
: return

avatar
y*g
14
bless
avatar
g*x
15
就是解释下GC的工作原理,然后我提到了WeakReference神马的,然后他就问我
WeakReference和Strong Reference的区别

【在 c*****l 的大作中提到】
: 麻烦请把这个解释下么?
: 4. describe java gc, diff between strong and weak references
: 谢谢~
: bless

avatar
s*s
16
我 CHI, BLESS

住.

【在 A***i 的大作中提到】
: 嗯,打倒万恶犹太seller.月底closing,到今天才来说要rent back.我们现在的房子是不
: 可能继续住下去了....
: 已经做好协商不成打官司的准备了. 只不过真那样的话,要在月底前找到另外的房子住.
: 大家祝福我吧!

avatar
c*i
17
请教一下:
4. get first pair of numbers in array that sum up to given value, return
their positions, e.g, 1, 1, 2, 4, 4, sum=5, return {0, 3}
这个不能sort的话, 有什么好方法吗?

hashtable)
1, 2,

【在 g*****x 的大作中提到】
: PHONE 1:
: 1. how to print a string backward
: 2. write code to find common elements in two arrays (2 pointers or hashtable)
: 3. ways to find pairs of elements that has specific sum
: 4. describe java gc, diff between strong and weak references
: 5. OOD for hotel reservation sys
: 6. two servers and one DB, how to improve performance
: PHONE 2:
: 1. write code to find pairs of elements that has specific sum, e.g, 1, 1, 2,
: 3, 3, sum=4, return {{1, 3}, {1, 3}, {1, 3}, {1, 3}}

avatar
A*i
18
告诉了.我lg给他打了电话,他lp说他lg很忙,没什么时间去找临时住处.他lg是一个专科
医生,可是大家都是有工作的人啊...
我也觉得会解决的,就是很焦虑,毕竟月底就要搬出这里,不管这个房子closing否, 想想
到时候就死翘翘了...

【在 n*******9 的大作中提到】
: 别急,先把实情告诉他们。都是人,没有整不了的。
avatar
g*e
19
hashmap

【在 c*****i 的大作中提到】
: 请教一下:
: 4. get first pair of numbers in array that sum up to given value, return
: their positions, e.g, 1, 1, 2, 4, 4, sum=5, return {0, 3}
: 这个不能sort的话, 有什么好方法吗?
:
: hashtable)
: 1, 2,

avatar
b*s
20
bless!

住.

【在 A***i 的大作中提到】
: 嗯,打倒万恶犹太seller.月底closing,到今天才来说要rent back.我们现在的房子是不
: 可能继续住下去了....
: 已经做好协商不成打官司的准备了. 只不过真那样的话,要在月底前找到另外的房子住.
: 大家祝福我吧!

avatar
g*x
21
这个我一上来就说了,他说这个浪费空间,要我改进算法

【在 g**e 的大作中提到】
: hashmap
avatar
s*n
22
bless

住.

【在 A***i 的大作中提到】
: 嗯,打倒万恶犹太seller.月底closing,到今天才来说要rent back.我们现在的房子是不
: 可能继续住下去了....
: 已经做好协商不成打官司的准备了. 只不过真那样的话,要在月底前找到另外的房子住.
: 大家祝福我吧!

avatar
g*e
23
不能sort(假设一开始数组无序),不能用额外空间,还要比O(n^2)快的算法我想不出来
只能求板上大牛指点了

【在 g*****x 的大作中提到】
: 这个我一上来就说了,他说这个浪费空间,要我改进算法
avatar
s*e
24
Bless

住.

【在 A***i 的大作中提到】
: 嗯,打倒万恶犹太seller.月底closing,到今天才来说要rent back.我们现在的房子是不
: 可能继续住下去了....
: 已经做好协商不成打官司的准备了. 只不过真那样的话,要在月底前找到另外的房子住.
: 大家祝福我吧!

avatar
g*i
25
请教下这两个问题
6. two servers and one DB, how to improve performance?
2. Find sum pair: what if array very huge (millions of TB of elements)

hashtable)
2,

【在 g*****x 的大作中提到】
: PHONE 1:
: 1. how to print a string backward
: 2. write code to find common elements in two arrays (2 pointers or hashtable)
: 3. ways to find pairs of elements that has specific sum
: 4. describe java gc, diff between strong and weak references
: 5. OOD for hotel reservation sys
: 6. two servers and one DB, how to improve performance
: PHONE 2:
: 1. write code to find pairs of elements that has specific sum, e.g, 1, 1, 2,
: 3, 3, sum=4, return {{1, 3}, {1, 3}, {1, 3}, {1, 3}}

avatar
s*s
26
祝福
avatar
g*x
27
其实很简单,reverse indexing
还是以{1, 1, 2, 4, 4}为例,reverse indexing后得到新数组rev_index {-1, 0, 2,
-1, 3}, 其中rev_index[i] == n表示 i 第一次在原数组中出现的位置,那找到rev_
index[1]和rev_index[4],都!=-1表示他们都出现过,即返回{0, 3}。。。缺点是如果
sum=999999而且假设数组中元素都非负,那就要建一个1000000大的rev_index

【在 g**e 的大作中提到】
: 不能sort(假设一开始数组无序),不能用额外空间,还要比O(n^2)快的算法我想不出来
: 只能求板上大牛指点了

avatar
P*e
28
bless!

住.

【在 A***i 的大作中提到】
: 嗯,打倒万恶犹太seller.月底closing,到今天才来说要rent back.我们现在的房子是不
: 可能继续住下去了....
: 已经做好协商不成打官司的准备了. 只不过真那样的话,要在月底前找到另外的房子住.
: 大家祝福我吧!

avatar
g*x
29
6. 是open question,随便说些你的想法,觉得在这样一个系统里哪里能改进性能,我
也是乱扯
2. 我也是胡扯,说用parallel computing,把数组存在好多机器上,然后类似
mergesort,每个机器上的各自先sort,然后merge A和B的时候比较A上最大的和B上最
小的,如果A上最大的数 > B上最小的数,就swap,把A上最大的数插入到B上合适的位
置,B上最小的数插入到A上合适的位置,然后一直这么可以搞成AB, CD, EF...这些
group上的数都递增,同样的方法可以得到ABCD, EFGH...的递增组。。。最后完全排序
,就可以用两个指针从头和尾移来移去的方法得到答案了

【在 g*****i 的大作中提到】
: 请教下这两个问题
: 6. two servers and one DB, how to improve performance?
: 2. Find sum pair: what if array very huge (millions of TB of elements)
:
: hashtable)
: 2,

avatar
c*i
30
bless!!!

住.

【在 A***i 的大作中提到】
: 嗯,打倒万恶犹太seller.月底closing,到今天才来说要rent back.我们现在的房子是不
: 可能继续住下去了....
: 已经做好协商不成打官司的准备了. 只不过真那样的话,要在月底前找到另外的房子住.
: 大家祝福我吧!

avatar
x*o
31
I think we can first sort the data (like merge sort),
then start from the first position, use a pointer to go through the rest to
search the second value.
since the data are sorted, we do not need to search for too many values.
there must be better methods. waiting.......

【在 g*****i 的大作中提到】
: 请教下这两个问题
: 6. two servers and one DB, how to improve performance?
: 2. Find sum pair: what if array very huge (millions of TB of elements)
:
: hashtable)
: 2,

avatar
h*n
32
先吃
补bless!
avatar
g*e
33
这不是一样用了O(n) space?

,

【在 g*****x 的大作中提到】
: 其实很简单,reverse indexing
: 还是以{1, 1, 2, 4, 4}为例,reverse indexing后得到新数组rev_index {-1, 0, 2,
: -1, 3}, 其中rev_index[i] == n表示 i 第一次在原数组中出现的位置,那找到rev_
: index[1]和rev_index[4],都!=-1表示他们都出现过,即返回{0, 3}。。。缺点是如果
: sum=999999而且假设数组中元素都非负,那就要建一个1000000大的rev_index

avatar
g*o
34
祝福!多谢包子!
avatar
g*x
35
我也觉得这样也很费空间啊,所以他问我有什么比HASHTABLE更好的,我想到这个,
reverse indexing几个词都说出口了,然后没敢再往下说,卡住了,他告诉我说就是
reverse indexing

【在 g**e 的大作中提到】
: 这不是一样用了O(n) space?
:
: ,

avatar
y*u
36
也来吃包子,祝顺利!
avatar
r*y
37
#4 on-site: how to define the first pair with sum = 5 ?
for example, 1 2 3 0 4, how to diff between first pair and
second pair?

hashtable)
2,

【在 g*****x 的大作中提到】
: PHONE 1:
: 1. how to print a string backward
: 2. write code to find common elements in two arrays (2 pointers or hashtable)
: 3. ways to find pairs of elements that has specific sum
: 4. describe java gc, diff between strong and weak references
: 5. OOD for hotel reservation sys
: 6. two servers and one DB, how to improve performance
: PHONE 2:
: 1. write code to find pairs of elements that has specific sum, e.g, 1, 1, 2,
: 3, 3, sum=4, return {{1, 3}, {1, 3}, {1, 3}, {1, 3}}

avatar
d*2
38
avatar
v*a
39
reverse indexing哪有比hashmap好啊!面试官瞎说
avatar
h*8
40
祝顺利!
avatar
g*x
41
in this case should be 2+3=5, since if you go through the array, 3 appears
before 4

【在 r*******y 的大作中提到】
: #4 on-site: how to define the first pair with sum = 5 ?
: for example, 1 2 3 0 4, how to diff between first pair and
: second pair?
:
: hashtable)
: 2,

avatar
x5
42
bless

住.

【在 A***i 的大作中提到】
: 嗯,打倒万恶犹太seller.月底closing,到今天才来说要rent back.我们现在的房子是不
: 可能继续住下去了....
: 已经做好协商不成打官司的准备了. 只不过真那样的话,要在月底前找到另外的房子住.
: 大家祝福我吧!

avatar
n*p
43
bless~
avatar
A*i
44
好的,最后一位

【在 x5 的大作中提到】
: bless
:
: 住.

avatar
g*x
45
矮油,花花。。。见到熟人了
他就让我改进,这个都已经O(N)了,我一上来想到建BST,可是光建树就要O(N),然后
我说reverse indexing,不知道他是否明白我的意思,只是说出这两个单词以后我觉得
要好大空间,所以就没往下说,然后问他能不能给HINT,他描述了下该怎么怎么,我一
听不就是reverse indexing么。。。然后我就说我刚才想说的也是这个,只是有这个那
个的concern啊。。。
avatar
A*i
46
好的,最后一位

【在 x5 的大作中提到】
: bless
:
: 住.

avatar
O*n
47
这里的reverse indexing指的是?

【在 g*****x 的大作中提到】
: 矮油,花花。。。见到熟人了
: 他就让我改进,这个都已经O(N)了,我一上来想到建BST,可是光建树就要O(N),然后
: 我说reverse indexing,不知道他是否明白我的意思,只是说出这两个单词以后我觉得
: 要好大空间,所以就没往下说,然后问他能不能给HINT,他描述了下该怎么怎么,我一
: 听不就是reverse indexing么。。。然后我就说我刚才想说的也是这个,只是有这个那
: 个的concern啊。。。

avatar
Y*n
48
Bless!
avatar
d*t
49
hash table, unless perfect hashing can be applied, it needs to store both
key(array[i]) and the value(i) for conflict resolution in most default
implementation, which results in somehow a waste of space. See this for
more explanation. http://javarevisited.blogspot.com/2011/02/how-hashmap-
works-in-java.html
But in terms of space complexity, inverted indexing is still O(n). I don't
see a big advantage anyway.

【在 g*****x 的大作中提到】
: 我也觉得这样也很费空间啊,所以他问我有什么比HASHTABLE更好的,我想到这个,
: reverse indexing几个词都说出口了,然后没敢再往下说,卡住了,他告诉我说就是
: reverse indexing

avatar
o*t
50
BLESS

住.

【在 A***i 的大作中提到】
: 嗯,打倒万恶犹太seller.月底closing,到今天才来说要rent back.我们现在的房子是不
: 可能继续住下去了....
: 已经做好协商不成打官司的准备了. 只不过真那样的话,要在月底前找到另外的房子住.
: 大家祝福我吧!

avatar
y*g
51
呵呵,收到包子了,人生的第一个包子啊,谢谢了。
希望MM一切顺利啊
avatar
P*f
52
bless

【在 g*********o 的大作中提到】
: 祝福!多谢包子!
avatar
s*y
53
我原来close的时间是11/30,和房东说好了租到11/30号,并且帮他找了个我同事继续
租这个公寓,结果11/30 close不了,拖了2周,我们也很着急,不过幸好同事让我们继
续住,他睡客厅,对付2周,我们付这2周的房租
avatar
n*e
54
re
avatar
d*7
55
bless
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。