电话T2内容# EB23 - 劳工卡
j*7
1 楼
面的组是Amazon Fulfillment in Seattle. 两轮电话面试,四轮on-site,每轮45分钟
。我是new grad.
1. Implement Huffman code. 面试官首先给了算法,然后叫我去implement.我用的是
min-heap 还有HashMap. 面试官看起来比较满意。
2. 老中bar raiser. 介绍project,然后做一道题。Given a list of integers of
length n, find the duplicate element. The integers are all in the range of 1
to n-1. There is only one duplicate element.
my answer: use a for loop to compute the sum of the list. Then returns sum-
(n-1)*n/2.
follow-up: Give another algorithm for this problem. Find as many algorithms
as you can.
3. Find all permutations of a string (我写的是CC150原题的答案).
4. 老印manager. 介绍project,然后做一道题。
Given a phone number as input, print all combinations of words that can be
produced from this phone number.
Ex. 2:ABC 3:DEF 4:GHI 5:JKL 6:MNO ....
Ex. input="234" ->{ADG,ADH,ADI, AEG,AEH,AEI, AFG,AFH,AFI,BDG,BDH,BDI...}
You can use a function to help you that returns a char given a digit and a
position. int function(int digit, int pos)
Ex. function(2,0)->'A' function(2,1)->'B' function(4,2)->'I'
我用了 depth first search.
最后问了几道有关OOP and Java 的问题。
1. What is your favorite language?
my answer: Java
2. What is encapsulation?
my answer: hide variables and methods, public, private, etc...
3. What is the difference between HashMap and HashTable?
my answer: HashMap is not thread-safe. HashTable is synchronized.
杯具了。不知道哪儿做的不对。
。我是new grad.
1. Implement Huffman code. 面试官首先给了算法,然后叫我去implement.我用的是
min-heap 还有HashMap. 面试官看起来比较满意。
2. 老中bar raiser. 介绍project,然后做一道题。Given a list of integers of
length n, find the duplicate element. The integers are all in the range of 1
to n-1. There is only one duplicate element.
my answer: use a for loop to compute the sum of the list. Then returns sum-
(n-1)*n/2.
follow-up: Give another algorithm for this problem. Find as many algorithms
as you can.
3. Find all permutations of a string (我写的是CC150原题的答案).
4. 老印manager. 介绍project,然后做一道题。
Given a phone number as input, print all combinations of words that can be
produced from this phone number.
Ex. 2:ABC 3:DEF 4:GHI 5:JKL 6:MNO ....
Ex. input="234" ->{ADG,ADH,ADI, AEG,AEH,AEI, AFG,AFH,AFI,BDG,BDH,BDI...}
You can use a function to help you that returns a char given a digit and a
position. int function(int digit, int pos)
Ex. function(2,0)->'A' function(2,1)->'B' function(4,2)->'I'
我用了 depth first search.
最后问了几道有关OOP and Java 的问题。
1. What is your favorite language?
my answer: Java
2. What is encapsulation?
my answer: hide variables and methods, public, private, etc...
3. What is the difference between HashMap and HashTable?
my answer: HashMap is not thread-safe. HashTable is synchronized.
杯具了。不知道哪儿做的不对。