amazonInterview
Amazon Interview Prepartion
Amazon 16 Principles
Customer Obsession(客户至上)
客户是上帝,requirement优先,任何影响上帝的事情都不能干, 如某 requirement影响了上帝的体验,你就是死键盘上也不能砍了,宁愿miss deadline
Ownership(主人翁精神)
为长远考虑,即客户几年之后可能会出现的需求也要考虑到, 不会为了交付短期的deadline,而牺牲长期的价值。(比如 global api 和 local api)
Insist on the Highest Standards(坚持最高标准)
最高标准,“最高”对应上面的“长远”。
Are Right, A Lot(通常是正确的)
般情况,能请示manager就请示manager,manager一般不会出错
Bias for Action(行动至上)
速度很重要,决策和行动都可以改变,因此不需要进行过于广泛的推敲但提倡在深思熟虑下进行冒险。
Dive Deep(深度剖析)
对问题刨根问底,探究细节
敢于承担责任,任劳任怨,比如领导说谁会java,你会你就跳出来说我会
Learn and Be Curious(不断学习并保持好奇)
Invent and Simplify(创新与简化)
Hire and Develop the Best(招聘和培养最优秀的人才)
领导者招募并培养顶尖人才,帮助他们成长,使团队整体变得更优秀。
Think Big(志存高远)
领导者设定宏大的愿景,并采取行动来实现。他们不满足于现状,敢于梦想并着眼于长远。
Frugality(精打细算)
领导者以少的资源达成更多的目标,他们善于在有限资源下寻找创新解决方案。
Earn Trust(赢得信任)
领导者通过谦逊、正直和透明的方式赢得他人的信任。他们倾听、尊重他人,并且以高标准要求自己。
Have Backbone; Disagree and Commit(有勇气提出异议并坚定执行)
领导者勇敢表达自己的不同意见,即使这可能会带来不便或不合群。他们讨论后,哪怕没有完全一致的意见,依然会全力支持最终的决定。
Deliver Results(结果导向)
领导者专注于实现高质量结果,按时完成任务。他们克服障碍,持续推动卓越表现。
Strive to Be Earth’s Best Employer(力争成为全球最佳雇主)
领导者关心员工的幸福和发展,致力于创造一个安全、包容和充满支持的工作环境。
Success and Scale Bring Broad Responsibility(成功与规模带来广泛的责任)
领导者意识到,随着公司规模的扩大,他们对社会、环境和未来世代的影响也越来越大。领导者必须保持谦逊,积极承担责任,做出积极改变。
OA
-
Fitness tracker (NG OA)
A user is using the Amazon fitness tracker, and they are engaged in a jumping exercise routine. The user is positioned on the ground, and there are
n
stones, each placed at different heights. The height of thei
th stone is represented byheight[i]
meters.The goal is to maximize the calorie burn during this exercise, and the calories burned when jumping from the
i
th stone to thej
th stone is calculated as (height[i]
-height[j]
) ^2.The user intends to practice jumping on each stone exactly once but can choose the order in which they jump. Since the user is looking to optimize their calorie burn for this single session, the task is to determine the maximum amount of calories that can be burned during the exercise.
Formally, given an array height of size
n
, representing the height of each stone, find the maximum amount of calories the user can burn.
Note that the user can jump from any stone to any stone, and the ground’s height is0
and once user jumps to stone from ground, he/she can never go back to ground. -
Care Get Minimum Score(NG OA)
Essence: Find the subarray in the array.
给定一个整数数组,给定两个数字,需要在原始数组中找到一个子数组,以便子数组覆盖给定的两个数字,并且子数组中不同数字的数量是最少的。返回子数组中不同数字的数量。
给出的两个数字也可以是相同的。如果它们相同,如果数组包含此数字,则返回1,如果不包含此数字,则返回0。
Case1:
array = [1, 2, 2, 2, 5, 2] series1 = 1 series2 = 5
The subarray must contain the series1 and series2 and having the smallest number of distinct values is [1, 2, 2, 2, 5], so return 3,
the number of distinct integers in this subarray.
Case2:
array = [1, 3, 2, 1, 4] series1 = 1 series2 = 2
The shortest subarray contains both series1 and series2 is [2, 1], so we return 2, the number of distinct values in this subarray.
Case3:
array = [3, 1, 2] series1 = 1 and series2 = 1
because series1 and series2 are the same, so if the array contains series1, that would be good. This array contains series1, so we return 1.
Case4:
array = [2, 4, 9] series1 = 1 and series2 = 1
because series1 and series2 are the same, but this array doesn’t contain series1, so we return 0.
-
Maximize Negative PnL Months
https://www.fastprep.io/problems/amazon-maximize-negative-pnl_months
You are analyzing the market trends of Amazon stocks. An AWS financial service model returned an array of integers,
PnL (Profit and Loss)
, for your portfolio representing that in the ith month, you will either gain or losePnL[i]
. All reported PnL values are positive, representing gains.As part of the analysis, you will perform the following operation on the PnL array any number of times:
Choose any month (0 ≤ i < n) and multiply
PnL[i]
by -1Find the maximum number of months you can afford to face a loss, i.e., have a negative PnL, such that the cumulative PnL for each of the n months remains strictly positive i.e. remains greater than 0.
Note: The cumulative PnL for the ith month is defined as the sum of PnL from the starting month up to the ith month. For example, the cumulative PnL for the PnL = [3, -2, 5, -6, 1] is [3, 1, 6, 0, 1].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21public int maximizeNegativePnLMonths(int[] PnL) {
return maximizeNegativePnLMonthsRecursive(PnL, 0, 0, 0);
}
private int maximizeNegativePnLMonthsRecursive(int[] PnL, int index, int cumulativeSum, int negativeMonths) {
// Base case: if all months are processed, return the count of negative months
if (index == PnL.length) {
return negativeMonths;
}
// Option 1: Leave the PnL as is and move to the next month
int maxNegativeMonths = maximizeNegativePnLMonthsRecursive(PnL, index + 1, cumulativeSum + PnL[index], negativeMonths);
// Option 2: Flip the sign of the PnL for the current month if it does not make the cumulative sum non-positive
if (cumulativeSum - PnL[index] > 0) { // Check if flipping won't result in a non-positive cumulative sum
maxNegativeMonths = Math.max(maxNegativeMonths,
maximizeNegativePnLMonthsRecursive(PnL, index + 1, cumulativeSum - PnL[index], negativeMonths + 1));
}
return maxNegativeMonths;
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21public int maximizeNegativePnLMonths(int[] PnL) {
return maximizeNegativePnLMonthsRecursive(PnL, 0, 0, 0);
}
private int maximizeNegativePnLMonthsRecursive(int[] PnL, int index, int cumulativeSum, int negativeMonths) {
// Base case: if all months are processed, return the count of negative months
if (index == PnL.length) {
return negativeMonths;
}
// Option 1: Leave the PnL as is and move to the next month
int maxNegativeMonths = maximizeNegativePnLMonthsRecursive(PnL, index + 1, cumulativeSum + PnL[index], negativeMonths);
// Option 2: Flip the sign of the PnL for the current month if it does not make the cumulative sum non-positive
if (cumulativeSum - PnL[index] > 0) { // Check if flipping won't result in a non-positive cumulative sum
maxNegativeMonths = Math.max(maxNegativeMonths,
maximizeNegativePnLMonthsRecursive(PnL, index + 1, cumulativeSum - PnL[index], negativeMonths + 1));
}
return maxNegativeMonths;
} -
smallest palindromes (NG OA)
Amazon’s software team utilizes several algorithms to maintain data integrity, one of which targets the encoding of symmetrical names. Symmetrical names are unique in that they read identically in both directions, similar to palindromes in language parlance.
The chief aim of the algorithm is to rearrange the characters in the original symmetrical name according to these criteria:
• The rearranged name is a reshuffled version of the original symmetrical name.
• The restructured name should be symmetrical as well.
• This restructured name should be lexicographically smallest among all its symmetric permutations.
Given an initial symmetrical name that contains only lowercase English characters, compute the encoded name.
A string
s
is considered to be lexicographically smaller than the stringt
of the same length if the first character in s that differs from that int
is smaller. For example, “abcd” is lexicographically smaller than “abdc” but larger than “abad”Note that the output encoded name could match the original name if it’s already the smallest lexicographically.
Example
The original string is nameString = “babab”.
This can be reversed to give “abbba”, which is a symmetric rearrangement of the original symmetrical name and is the smallest possible reverse order.
It satisfies all the requirements so return the string abbba.
Function Description
Complete the function computeEncodedProductName in the editor below.
题目理解
给一个string
- 要给出一个 palindrome string
- the string must be the smallest string based on lexicographical order
Eg:
babab —> a bbb a
破题点
统计每个char的freq
如果是palindrome string
freq of char must be two cases:
-
all even
-
even + one odd case
-
genome sequencing (NG OA)
Data scientists at Amazon are working on a utility for genome sequencing algorithms. The utility finds anagram patterns in a pair of DNA sequence strings. A pair of DNA is special if they are anagrams after removing any number of occurrences of at most one character from each DNA sequence.
Given n pairs of DNA, for each pair, attempt to make them anagrams. Return a list of boolean values, one for each pair, where True means a pair is special.
Example
Given, n = 1, pair and strings dna1 = “safddadfs” and dna2 = “famafmss”.
The strings are anagrams after removing all the occurrences of character
d
froms
and character'm
fromt
. Return [True].Note: It is not required that all instances of a character be removed. For example, given
aab
andba
, onea
can be removed fromaab
to leaveab
.Function Description
Complete the function getSequence in the editor below.
getSequence has the following parameter(s):
string
dna [n] [2]
the pairs of DNA sequences.Returns
bool[n]
:true
if the pair is special, andfalse
otherwise.题目理解
pair
dna1 = "safddadfs"
anddna2 = "famafmss"
1
2dna1 = safddadfs` → `{'s': 2, 'a': 2, 'f': 2, 'd': 3}
dna2 = famafmss → {'f': 2, 'a': 2, 'm': 2, 's': 2}Differences in character frequencies:
's'
: 0 (same count)'a'
: 0 (same count)'f'
: 0 (same count)'d'
: 3 (exists only indna1
)'m'
: 2 (exists only indna2
)
the characters
'd'
and'm'
differ.Removing all occurrences of
'd'
fromdna1
and'm'
fromdna2
—> makes the strings anagrams.破提点
遍历 s 和 t,统计每个char的freq 到 letters[26]中
遍历两个 letters[26] 出现differece,就count++
如果count > 2 那么return false
-
genome sequencing algorithms
Data scientists at Amazon are working on a utility for genome sequencing algorithms. The utility finds anagram patterns in a pair of DNA sequence strings. A pair of DNA is special if they are anagrams after removing any number of occurrences of at most one character from each DNA sequence.
Given n pairs of DNA, for each pair, attempt to make them anagrams. Return a list of boolean values, one for each pair, where True means a pair is special.
-
getOperation (全职)
There are n processes. The
i
th process hasresource[i]
number of resources. All theresource[i]
are distinct. The CPU wants the processes to be arranged in increasing order of theirresource[i]
.The CPU does several operations to get this.
In each operation, the CPU selects an integer
x
and a process with number ofresources = x
.It then places all processes with resource values less than
x
before the processes with resource values greater than or equal tox
, maintaining their original order.i.e.
the relative order between processes having resource value less than x should be maintained and the same applies for processes having resource value greater than or equal to x.
Find the lexicographically smallest sequence of
x
that the CPU chooses, such that it takes the minimum number of operations to complete the task.
Note: If the minimum number of operations = 0, then return -1.题目理解
n = 6
resource = [6, 4, 3, 5, 2, 1]
1
[6, 4, 3, 5, 2, 1]
我们需要通过最少的操作把
resource
数组按从小到大的顺序排序,最终变成[1, 2, 3, 4, 5, 6]
选择x=2 —> 把所有资源值小于
2
的放在前面,其他的保持原顺序:1
[6, 4, 3, 5, 2, 1] -> [1, 6, 4, 3, 5, 2]
第一个元素 1 已经到正确位置了。
选择x=3
1
[1, 6, 4, 3, 5, 2] -> [1, 2, 6, 4, 3, 5]
前两个元素
[1, 2]
已经到正确位置。选择 x = 4
1
[1, 2, 6, 4, 3, 5] -> [1, 2, 3, 6, 4, 5]
前三个元素
[1, 2, 3]
已经到正确位置。选择 x = 6
1
[1, 2, 3, 6, 4, 5] -> [1, 2, 3, 4, 5, 6]
总过操作了4次 —> x是 [2, 3, 4, 6]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20public static List<Integer> getOperations(List<Integer> resource) {
// Creates array, arr[0] is the value of resource, arr[1] is the index.
int[][] arr = new int[resource.size()][2];
for(int i = 0; i < resource.size(); i++) {
arr[i][0] = resource.get(i);
arr[i][1] = i;
}
Arrays.sort(arr, Comparator.comparingInt(a -> a[0])); // Sorts the array by value.
List<Integer> result = new ArrayList<>();
for(int i = 1; i < arr.length; i++) {
// If the index of the larger number is before the smaller one, we will select this number.
if(arr[i][1] < arr[i - 1][1]) {
result.add(arr[i][0]);
}
}
if(result.isEmpty()) {
result.add(-1);
}
return result;
} -
suitableLocations(全职)
Amazon has multiple delivery centers and delivery warehouses all over the world! The world is represented by a number line from - 10º to 10°.
There are
n
delivery centers, theith
one at locationcenter[i]
. A locationx
is called a suitable location for a warehouse if it is possible to bring all the products to that point by traveling a distance of no more thand
. At any one time, products can be brought from one delivery center and placed at pointx
. Given the positions ofn
delivery centers, calculate the number of suitable locations in the world. That is, calculate the number of pointsx
on the number line ( -10° ≤ × ≤ 10°) where the travel distance required to bring all the products to that point is less than or equal tod
.Note: The distance between point
x
andcenter[i]
is |x - center[i]|, their absolute difference.Example
Given n = 3, center = [-2, 1, 0], d = 8.
题目理解
Given n = 3, center = [-2, 1, 0], d = 8.
Locate the warehouse at x = -3:
First bring products from center[0] = -2 covering a distance of |-3 - (-2)| = 1 to reach the center
and | -3 - (-2)| = 1 to return.
Similarly we bring products from centers 1 and 2 to point -3 for total distance of 1 + 1 + 4 + 4 + 3 + 3 = 16
which is > d. This is not a suitable location.
一个位置
x
是合适的位置,当且仅当从所有配送中心到位置x
的距离都不超过d
。距离定义为位置x
与每个配送中心center[i]
的绝对差值|x - center[i]|
。解法
我们需要找到一个公共区间,即所有配送中心的区间
[center[i] - d, center[i] + d]
的交集。这个交集的区间就是所有可能的合适位置x
的范围。 -
compression matrix (ngOA)
2024.09.17 最新NG面经
一个 n x n 的矩阵,每个位置都有一个数,给一个list,告诉可以从每行取几个数,例如[2,1,2] , 就代表可以从第一行取2个数,第二行取1个数,第三行取2个数。从所有取得的数中,返回top K之和,使得这个和最大。
-
get minimum total distance(ngOA)
0907NG面经
https://fastprep.io/problems/amazon-get-min-total-distance
Amazon has recently established n distribution centers in a new location. They want to set up 2 warehouses to serve these distribution centers. Note that the centers and warehouses are all built along a straight line. A distribution center has its demands met by the warehouse that is closest to it. A logistics team wants to choose the location of the warehouses such that the sum of the distances of the distribution centers to their closest warehouses is minimized.
Given an array dist_centers, that represent the positions of the distribution centers, return the minimum sum of distances to their closest warehouses if the warehouses are positioned optimally.
Function Description
Complete the function getMinTotalDistance in the editor.
getMinTotalDistance has the following parameter:
int dist_centers[n]: the locations of the distribution centers
Returns
int: the minimum sum of distances
Example 1:
Input: dist_centers = [1, 2, 3]
Output: 1
Explanation:
One optimal solution is to position the 2 warehouses at x1 = 1 and x2 = 2.
-
Get Minimum Boxes(ngOA)
https://www.fastprep.io/problems/amazon-get-minimum-boxes
The supply chain manager at one of Amazon’s warehouses is shipping the last container of the day. All
n
boxes have been loaded into the truck with their sizes represented in the arrayboxes
. The truck may not have enough capacity to store all the boxes though, so some of the boxes may have to be unloaded. The remaining boxes must satisfy the conditionmax(boxes) ≤ capacity * min(boxes)
.Given the array,
boxes
, andcapacity
, find the minimum number of boxes that need to be unloaded.Function Description
Complete the function
getMinimumBoxes
in the editor.getMinimumBoxes
has the following parameters:-
int[] boxes
: an array of integers representing the sizes of the boxes
-
int capacity
: the capacity of the truck
Returns
int: the minimum number of boxes that need to be unloaded
-
-
Reduce the number of gifts(全职)
我们有一组商品的价格,需要保证任何k个商品的总价都不超过某个设定的阈值。目标是找出移除最少的商品,使得剩下的商品满足这个条件。如果商品数量少于k,则无需移除商品。
输入:价格 = [9, 6, 3, 2, 9, 10, 11], k = 3, 阈值 = 13
输出:2
解释:移除价格为9和7的商品后,没有任意三个商品的价格总和超过阈值13考虑使用 滑动窗口
-
Get maximum negative gain/loss(全职)
给定一个表示损益的整数数组PnL,允许你将数组中的某些元素乘以-1,以最大化PnL数组中的负数数量,同时保证每个月的累计PnL(从第一个月到当前月的总和)始终为正。
输入:PnL = [5, 3, 1, 2]
输出:2
解释:修改后的数组为 [5, 3, -1, 2],可以承受2个负数
题目理解
初始累计PnL计算
第1个月:5 (5)
第2个月:5 + 3 = 8 (8)
第3个月:8 + 1 = 9 (9)
第4个月:9 + 2 = 11 (11)
初始的累计PnL数组是:[5, 8, 9, 11]。没有负数,每个累计PnL都大于0
贪心 从最小值开始(从较小的正数开始改变,这样能保持累计和不至于变负)
尝试将第3个月的1变为-1
修改后的PnL数组是:[5, 3, -1, 2]
修改后的累计PnL:
- 第1个月:5
- 第2个月:5 + 3 = 8
- 第3个月:8 - 1 = 7
- 第4个月:7 + 2 = 9
新的累计PnL数组是:[5, 8, 7, 9],仍然全为正数
将第4个月的2变为-2
修改后的PnL数组是:[5, 3, -1, -2]
修改后的累计PnL:
- 第1个月:5
- 第2个月:5 + 3 = 8
- 第3个月:8 - 1 = 7
- 第4个月:7 - 2 = 5
新的累计PnL数组是:[5, 8, 7, 5],依然全为正数
我们将
PnL
中的两个元素变为负数,同时每个月的累计损益保持为正数。因此,输出结果为 2,表示我们可以最多将 2个月份 的损益值转为负数。
-
Service Request(在职)
Web Services (AWS) is a cloud computing platform with multiple servers. One of the servers is assigned to serve customer requests. There are n customer requests placed sequentially in a queue, where the
i
th request has a maximum waiting time denoted bywait[i]
. That is, if thei
th request is not served withinwait[i]
seconds, then the request expires and it is removed from the queue. The server processes the request following the First In First Out (FIFO) principle. The1
st request is processed first, and then
th request is served last. At each second, the first request in the queue is processed. At the next second, the processed request and any expired requests are removed from the queue. Given the maximum waiting time of each request denoted by the array wait, find the number of requests present in the queue at every second until it is empty.Note: If a request is served at some time instant
t
, it will be counted for that instant and is removed at the next instant.输入:
wait = [2, 2, 3, 1]
输出:
[4, 2, 1, 0]
模拟服务器处理客户请求的过程。我们需要理解每个请求都有一个最大等待时间,如果超过这个时间没被处理,请求就会被移除。题目要求我们找出每秒钟队列中剩余的请求数量。
第 0 秒:处理第 1 个请求,队列剩余 4 个请求。
第 1 秒:处理第 2 个请求,并移除过期的第 4 个请求,队列剩余 2 个请求。
第 2 秒:处理第 3 个请求,队列剩余 1 个请求。
第 3 秒:处理完最后一个请求,队列清空。
第 0 秒:
[1, 2, 3, 4]
处理第一个请求(
wait[0] = 2
),剩余的请求是:[2, 3, 4],此时队列有 4 个请求。第 1 秒:
[2, 3, 4]
处理第 2 个请求(
wait[1] = 2
),但第 4 个请求的wait[3] = 1
,超时了,移除第 4 个请求。剩余的请求是:[3],此时队列有 2 个请求。
第 2 秒:
队列中的请求:[3]
处理第 3 个请求(
wait[2] = 3
),剩余的请求是:[空],此时队列有 1 个请求。第 3 秒:
队列为空,输出 0。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23def findRequestsInQueue(wait):
n = len(wait)
result = []
time = 0 # 初始化时间
queue = list(range(n)) # 模拟队列(以索引表示请求)
while queue:
# 每一秒钟
result.append(len(queue)) # 当前队列中请求数量
# 移除当前正在处理的第一个请求
queue.pop(0)
# 更新时间
time += 1
# 移除超时的请求
queue = [i for i in queue if wait[i] > time]
# 最后队列为空
result.append(0)
return result-
task scheduler(SDEII)
-
create rectangles
Given an array of n integers, you are required to create rectangles using pairs of integers from the array. Note that a particular integer can be used in at most one rectangle, and in order to create a rectangle, we must have exactly two pairs of integers with the same values. For example, you can create a rectangle using integers [2, 2, 5, 5] and [4, 4, 4, 4], but not with [3, 3, 5, 8]. The goal is to maximize the total sum of areas of all the rectangles formed.
To make the problem more interesting, you are allowed to reduce any integer by at most 1.
Given the array of integers, find the maximum sum of areas of rectangles that can be formed such that each element of the array can be used as length or breadth of at most one rectangle, and you are allowed to decrease any integer by at most 1.
-
Sort Permutation (在职)
-
Find Requests in Queue (在职)
-
Max Channel Quality
-
Max Points from Sprints
-
packets
一堆packets,几个 channel,要求每个 packet都至少通过一个 channel,每个 channel 都至少有一个 packet 通过。对每个channel中通过的 packet 数值求个 median,把每个 channel 的 median 加起来得到一个和。问各种分配packet的情况下,可能得到的最大的和是多少?
-
Work Simulation
两大原则:
-
requirement排在第一,deadline第二
-
有manager出现的选项无脑选manager
Tips:
- 时间充足, 仔细读题, 慢慢做
- 打分并不是每个都要1, 2, 3, 4, 5, 因为你可以打比如2个5, 3个4也是可以的,所以还是很多变数的
- 每收到email就要看看, email中会有后面的题目需要的信息
例子
Rate DDL
Please rate the effectiveness of each response option for meeting the deadline.
- Work on the project on your own putting in extra effort to finish on time.
- Work on the project on your own until Priya(员工名字) is available, then continue to work on it together.
- Work on the project with Ben being sure to watch his work closely because of this lack of experience.
- Tell your
manager
you will not be able to complete the project in the time available.- Cut features from the product so you will be able to meet the two week deadline.
- Start working on the project right away with Ben. Then ask Priya to contribute what left
Answer:
先告诉Manager有不能按时完成的风险 4 —> 5
2 和 3 利用资源 —>4
1 自己单独做,可以但是没有利用资源 —> 3
5 删除功能 不支持 —> 1
3 4 4 5 1 5
2 - Work on theproject on your own, putting in extra effort to finish on time
3 - Work on theproject on your own until Priya is available, then continue to work on ittogether
4 - Work on theproject with Ben, being sure to watch his work closely because of his lack ofexperience
5 - Tell your manageryou will not be able to complete the project in the time avaliable
1 - Cut features fromthe product so you will be able to meet the two week deadline
3 - Start working onthe project right away with Ben. Then ask Priya to contribute what she can whenshe is avaliable
提前完成Project
别的Team要依赖于你的项目,需要你把原先2周的活在用一周完成
Ask your whold team for help
, explaining the urgency that another is blocked.- Work with the Customer Incentives Team to identify the critical features that they need by the deadline and focus on those.
- Push the timeline back another week to ensure there is enough time for all work to be completed accurately.
- Ask your
manager
for help in determining the best approach to meet the new deadline.- Put in extra hours yourself to make sure everything gets done on time.
Answer:
先报告manager 4—> 5
利用资源 1—> 4
自己加班完成 2 —> 3
跟别的team商量 完成核心优先 2—> 2
推迟DDL 没有沟通,影响其它team 3—>1
Upgrade System
Retail Website Team是我们的客户, 我们答应了他们要做两个features.
说咱们现在要帮人做两个feature,一个让100%用户爽,还有个让20%的用户爽。
但是咱们现在还要升级一下系统,升级系统会让我们自己组爽,
但是升级会推迟帮忙做的feature,不升级吧,以后升级之后还得做一遍。
- 升级, 在deadline前完成feature 1, 在deadline后完成feature 2
- 升级, 把Retail Website Team的需求推后, 这样可以让我们更有效率的服务用户
- 不升级,
优先完成我们答应的features
, 然后把我们其它项目的deadline向后推一下, 做系统升级,- 不升级,
完成我们答应的features
, 然后再找时间升级- 升级, 把Retail Website Team的需求推后, 因为这样可以避免我们做同样的事两次
- 不升级, 因为这样对Retail Website Team没什么重大的影响, 我们要focus on Retail Website Team的需求上
Answer:
不升级,做features,用户优先 4—> 5, 推迟项目了 3—> 3
以后也不升级,不好 6—> 2
升级中
1最好 1—> 4;
推迟顾客需求 2—> 1;
推迟顾客需求 5 —> 1
4 - We should notperform this upgrade at this point in time. We promised the Retail Website Teamwe would have their new features complete by the proposed deadline. Let’spostpone the upgrade to another time
2 - We should notperform the upgrade because it will not have a significant impact on the RetailWebsite Team’s experience. We should focus on the Retail Website Team’srequests
3 - We should notperform this upgrade at this point in time. Our top focus is meeting our agreedupon commitment with the Retail Website Team, so we should finish that first.We can focus on the upgrade afterwards by pushing our deadlines for some of ourother projects
1 - I think we shouldperform the upgrade. The right thing to do is push back on the Retail WebsiteTeam because it will keep our team from having to do the same work twice
5 - I think we shouldperform the upgrade. As a compromise, we can include the gift recommendationfeature the Retail Website Team wants by the deadline and then complete theupgrade. We can finish the seasonal-based gift recommendations feature afterthe deadline
2 - I think we shouldperform the upgrade. The right thing to do is push back on the Retail WebsiteTeam because it will allow us to more efficiently serve the customer and thecustomer will be helped in the long run.
Time Arrangement
Feature Engineer Estimate of Time to Develop Product Manager’s Prioritization of Benefit A 1 to 2 weeks Medium B 4 to 6 weeks High C 2 to 4 weeks Low D 2 to 4 weeks Medium E 5 to 9 weeks High F 3 to 5 weeks High G 2 to 4 weeks Medium H 1 to 2 weeks Low Rate the effectiveness of each of the following options:
- F, G
- A, B, D
- A, C, D, G
- A, D, F
- A, C, F
- A, C, D, G, H
Answer:
时间 和 task priority 衡量
- 优先 high feature
- time arrange reasonable
High: B, E, F
Medium: A, D, G
Low: C, H选项分析:
- F G
time: 5-9 weeks
level: H + M虽然有一个H,但是task总数少,效率低。
- A B D
Time: 7-12 weeks
level: H + M + L
选了H,任务安排合理,时间有一点紧,整体不错
- A C D G
Time: 7-14 weeks
Level: 3M + L
无高任务,任务虽然多,但是没优先级,时间跨度大,性价比低
- A D F
Time: 8-15 weeks
Level: 3M + 2L
无高任务,任务多,时间跨度大,难以按时完成
最佳选择
A+E+F —> 1个H 加 2 个M
时间安排 6-14 weeks 合理
数量级3 合理
次优选择
A + B + D —> 1个H 加 2 个M
时间 7-12 weeks 略微紧张
任务数量3 合理
website problem
Jacob发邮件来说线上网站遇到了问题, 他不知道为什么, 来寻求帮助. 然后要向Jacob提问, 给以下问题的重要性评分
- Do any other projects depend on fixing this problem?
- How long will it take to solve this problem?
- How does this affect
customers
?- Are we receiving complaints from
customers
?- How many
customers
is this affecting?- If I help you with this problem, will you help me finish my work today?
Answer:
和顾客相关:3 —> 5; 4 —> 5; 5—>5
依赖关系: 1—>4
时间评估: 2—>3
6—>1
3 - Do any otherprojects depend on fixing this problem?
5 - How many customersis this affecting?
5 - How does thisaffect customers
4 - Are we receivingcomplaints from customers?
2 - How long will ittake to solve this problem?
1 - If I help you withthis problem, will you help me finish my work today?
图书馆场景题
team项目介绍,log分析和bug
5 - Increase time alotted for testing in overall lifecycle.
5 - Update automated end-to-end tests to include broader data coverage.
3 - Write more unit tests to include edge cases.
3 - Have team members perform more manual testing before checking code in.
1 - Increase the sizeof QA team.
1 - Have more usertesting in beta phase.图书推荐系统,关于book API,两人观点不一样
永远选tell me more
图书馆实体API
自己设计API覆盖面全,别人做的可以赶上due
requirement优先原则,tell me more层层递进。
然后考虑全面,长远考虑
服务器挂
检查internal bug
我认为3出问题了,但是也去看其它的report
队友说没错,自己去查(不要麻烦别人)
增加测试时间 和 覆盖更多case —> 5
manuel test —> 3
Unit test —> 3
增加QA人手 —> 1
让客服小白鼠 —> 1
Amazon 推荐系统
第一个issue失败 —> username太长
第二个总是显示germany —> 使用了proxy的name觉定语言
case media network 服务器 好多 complaints
德国的,和 invalid recommendation,返回404
出错共同点—> 1.用户名名字太长 2.用户语言变德语
客户DDL只有2week,两个cases
- 延到4week,做完整
- 先实现一步,做个demo,然后慢慢做
先实现demo 放到 5
按部就班4周 放3
通知其他做说做不 放1
估计项目开发时间
manager 出现 放5
有经验人请求 放4
上网查资料 or 先做一段时间再估计放 3
其它裸上,硬送 放1
项目时间表设计
Roadmap
最会什么语言 java
Since you know moreabout the programming language than anyone else, you revise the estimate forporting to Java.
安排会议
视频会议 5
3个老二开会 3
老二去找老大开会 3
推迟会议和邮件开会 1
搞个数据库
2week搞个数据库
报告manager 放5
和大腿合作放4
合作/等大腿 放3
自己单干 1
cut features 1
系统升级
做两个features,
1个让用户100%爽
1个让20%的用户爽,但是要升级系统,自己也会爽,但是升级会推迟features
中心在于不升级,先做features,让用户爽先
先做100的feature再升级,再做20的feature,放5
不升级,因为我们承诺要做feature,放4。
不升级,要搞定feature,可以以后推了其他ddl再升级,放3
不升级,因为对其他组没影响,我们应该focus在request上面,放2
升级,推迟这两个feature的ddl,因为升级造福子孙后代,放2
升级,不然要做两次,放1
新产品设计
给8周时间,选择题,让你pick up 一个features的组合要求利益最大化, 每个feature都有相应的价值,H>>M >>L 都代表远大于
首先ddl是前提,中位收不能超过8太多,那样的话就算feature再多也没意义, 同价值,按照ddl排疗个同ddl按照价值排序。
代码分析
三段—长选最长
Schedule the design reviewmeeting
1 - We can take our best guess at an estimate on our own
2 - We should work fora couple of days to gauge our progress, and then complete our estimate fromthere
4 - We shouldconsult a coworker
who has more relevant experience on this type of task
3 - We should conductourown investigation
utilizing online research materials and internaldocumentation
5 - Let’s ask ourmanager
how we should go about developing an estimateSchedule the design review meeting (2)
3 - Ask all parties to identify a
back-up person
who could meet during a designated time
3 - See if there is abackup person
on the Localization Team that can meet
5 -Set-up video conferencing
to include all POC’s regardless of their physical location
1 - Agree topostpon
e the design review for two weeks when all parties have more availability
2 - Discuss the design review over
4 - Agree toschedule the meeting
at Xavier’s locationan hour away
finding the issues with the resources available to you
rate: 1 - 5
Highly Effective
Very Effective
Moderately Effective
Slightly Effective
Ineffective
Investigate the failed requests but
ignore the valid requests
3Search the
logs
for errors in the timeframe that the error occurred 1Tell the technician this is a
one-time glitch
and should resolve itself 5Look at metrics (e.g., latency, throughput, error counts, number of requests in the last hour) and look for any strange behavior 1
Go to the code directly and try to find the bug manually 3
体现了Bias for Action 但是缺少Dive Deep
Analyze the
logs
for specific requests that might have failed 1Immediately ask a more experienced engineer for assistance since it is an urgent issue 2
展现了Learn and Be Curious和Earn Trust
what it the root reason after check
Requests in which customer-reviews and the customer-rating arrays do not have the same number of elements are causing issues.
Dive Deep + Insist on the Highest Standards
Which of the following are pros of implementing Feature 1?
Select four (4) advantages of implementing
Would be a good opportunity to boost revenue
收入: 符合亚马逊追求持续增长
Scalable across multiple platforms
跨平台的可扩展性 —> 帮助公司长远地扩大影响力和市场份额。
Potentially develops long-term relationships with a younger demographic
吸引用户 —> 长期的客户关系
Allows for more engagement across multiple social media platforms
在多个平台 —> 提升品牌影响力和用户参与度
Which of the following are pros of implementing Feature 2? Select two
The external team will likely be more willing to assist with Feature 2
Opportunity to build a good working relationship with the external team
Take a vote on your team because both approaches have pros and cons
Take a vote on your team because both approaches have pros and cons 3
Go with your own option because you’ve already weighed the pros and cons and know what will have most impact for Amazon 4
Go with Kelly Ling’s recommendation since she is more experienced than you 3
Meet with the
senior engineers
and other high-level decision makers (e.g., manager, directors) to get their input 1Set up
meeting with Kelly Ling
and external team to decide which feature to implement 2Ask your
manager
for guidance on the decision 1
delivery new features in given timeline
Tell your manager that you cannot complete this by yourself and suggest your manager bring in additional resources 1
Start working on it even though you know it probably won’t get it done. After a few weeks, report your pro ngress to your manager and request additional resources 5
Prioritize social media platforms and work on the most critical first and delay other platforms until after the deadline 2
Plan to work overtime alone in order to get it done 5
Push back on the requirements and suggest only integrating with 1 or 2 additional social media platforms 4
Do not extensively test in order to meet the deadline and be able to deliver results within the deadline 5
On your own, ask other team members if they can pitch in and help 2
符合“Earn Trust”(赢得信任)和“Are Right, A Lot”(常常正确)原则
If you could request additional information, what would help you to determine the better algorithm?
Select the two (2) most relevant response options.
Predicted future trends in data that may impact efficiency of the algorithms
Whether number of deliveries or mileage is the higher priority
Hi,
I was able to get the updated hourly traffic information related to these algorithms for the past 3 days. Take a look and see if this is helpful in making your decision. I’ve also included the original aggregate traffic data used to build the algorithm. Remember that we need to launch this feature in the next 3 days.
Thanks,
Nadia Diaz
Team Lead
What is your final recommendation?
Select the one (1) best response option.
如果交付效率是主要关注点,可能倾向于选择算法#1;如果控制里程更关键,可能选择算法#2。
选择 No conclusive decision can be made with the given data
如果感觉现有数据不足以做出决策,建议进一步分析或开发新算法
Push the code change without testing since it is a very easy change 5
Since both the
product manager
andyour manager
have valid concerns, push the decision back on yourmanager
3Release the change
only
when the tests are ready 1完全符合“Insist on the Highest Standards”和“Earn Trust”原则
Talk to a senior engineer who has a better understanding of the risks before deciding how to proceed 2
Set up a quick meeting with the
product manager
,your manager
, and you to decide how to handle this issue 2
Let Dai make the mistake and stay out of it since it is not your project 5
Show Dai error reports from previous attempts to push code without testing 1
体现了“Learn and Be Curious”以及“Insist on the Highest Standards”,通过具体例子帮助同事认识到测试的重要性。
Ask a
senior engineer
or others from your team how to handle this situation where coworker wants to push out code without properly testing 2Report this situation to
Dai's manager
3确保问题得到解决,但可能影响团队间的信任和关系
Set aside your work and offer to help test the code 1
直接提供帮助进行测试是一种积极参与的方式,可以立即解决问题
这不仅体现了高度的责任感和团队合作精神,也直接帮助确保代码质量
Advise him to check with
his manager
or asenior engineer
on his team before moving forward 2这种方式鼓励Dai自己寻求指导,同时避免了直接的冲突,有助于其个人和职业成长
Work with Dai to revert the code change 1
对问题的直接解决和责任感
Try to contact a
senior engineer
on how best to proceed to fix the issue 2Ignore Dai’s instant message and sign off 5
Tell Dai that you told him that was a bad idea 4
Work with Dai to push another code change to fix Dai’s problem immediately 2
新的更改经过适当测试并且确信可以解决问题,这将是一个有效的解决方案
Write up a document to share the knowledge of what happened and how to fix the issue so it doesn’t happen again
VO
9.12 3轮NG
第一轮
1题 lc: 316
第二轮
全BQ
BQ被follow up的很深
第三轮
2BQ + OOD
OOD: dog day care System
OOD狂问error handeling 还有各种奇葩case 和problem
有large dog play ground 和 small dog play ground,20 和30的max limit
提供dog id
implement check in 和 check out
需要verify dog age and vaccination(这个是assume 已经存在的function)
9.13 3轮NG
第一轮
纯BQ 3-4 LP
tight deadline,conflict,beyond scope
每一个都会有很多follow up,但是不是难为你的那种,主要是看你是不是真的参与了这个project。
第二轮
20 minutes BQ + lc 56
help others, tight deadline
第三轮
20 minutes BQ + lc 347
conflict, dive deep
9.10 3轮NG
第一轮
纯code lc 347
第二轮
bq + coding
biggest challenge + out of responsibility —> 4/5 个follow up
输入是list of strings,根据给定的constraint分组 follow up就是加各种constraint
第三轮
纯bq
dive deep + teammate struggle + conflict + out side of responsibility
Dive deep(问你有没有过dive deep的经历)
9.10 3轮NG
每個LP可以準備個兩個故事
第一轮 OOD + BQ
第二轮 全BQ
第三轮 BQ + lc 53
9.11 3轮NG
第一轮
Software Development Manager (SDM)
Behavioral Questions, BQ,共约6个问题
第二轮 纯code
Senior Engineer
链表和二叉搜索树(BST) lec 235(0类似)
第三轮 OOD
Bar Rise
设计的是停车场系统
9.08 3轮NG
第一轮 BQ + OOD
3BQ
Biggest Challenge, Helping peers, Complete a complex project
OOD
Parking lot然后每个车都有个max time stay in the lot
第二轮 纯BQ
4个bq
- out of comfort zone
- Disagreement with supervisor
- Failure
- Do more than required from you
第三轮
2 lc
给一个network,怎么找到head of the node in the network that can reach the rest of the nodes in the network(差不多这个意思 当时题用的head of the bank举例)。
用bank举例。每个bank1可以transfer钱到bank2,bank3可以到bank4,那么给你这么多bank 的一个network,你需要找一个headquarter of the bank,这个headquarter可以做到无论哪个bank需要钱,都可以有办法transfer钱过去。
题目理解
你给了一个银行网络,每个银行可以转账到其他银行。问题是在这个网络中,找到一个headquarter(总部银行),该银行能够通过直接或间接的转账方式到达所有其他银行。
如何在有向图中找到一个节点,它可以到达所有其他节点?
思路
有向图的强连通分量(SCC,Strongly Connected Components):
- 如果网络是一个强连通图(strongly connected graph),那么图中每个节点都可以到达所有其他节点,这样可以任选一个节点作为总部。
- 但如果不是强连通图,我们需要找到一个可以到达所有其他节点的"关键节点"。
拓扑排序(Topological Sorting):
- 可以将图进行拓扑排序,拓扑排序的最后一个节点(顺序最末尾的节点)是潜在的候选节点。这个节点有可能是head node,因为在拓扑排序中,它是被依赖的节点。
缩点思想:
- 可以将图中的强连通分量缩为一个节点,形成一个DAG(有向无环图)。在缩点后的DAG中,"入度为0"的节点(即没有其他节点指向它的节点)可能就是head node。
given a 2d grid of weights and a crane, crane 从左往右动,每次只能向右,右上,或者右下移动。从左到右移动完找max weight。
09.04 3轮NG
第一轮 BQ + lc
第二轮 纯OOD
SD 考察缓存,要call remote server, 设计lazy callapi
考了我system design, 上来就开始问问题,无bq, 无自我介绍(只有他自己简短说了一下他工作几年), 但是因为楼主ng看地理也只考ood, 所以不会,面试过程说了不会他还是继续追问,我只能按照ood强行写了一点
第三轮 纯BQ
09.04 3轮NG
每轮BQ大概会问2-3个问题
第一轮 BQ + lc
Learn and be curious
K lists M elements getNextSmallest(), follow up问了如何optimize
第二轮 BQ + lc
Tell me a time you go above and beyond
Lc 146
follow up问了如果每个cache会expired
第三轮 OOD
BQ
Most challenge project, Tight deadline
OOD
pizza order
算pizza价格, follow up问了pre-made pizza,menu有别的东西
9.06 3轮NG
第一轮 BQ + lc
design bigInt class —》 类似lc 43
第二轮 纯BQ
why amazon should hire you
take extra responsibilities
improve based on feedback
第三轮 OOD
购物系统
input是付款信息和买的东西,然后根据input让check三个条件
followup问如果条件更多会怎么样
9.10 3轮NG
Readfile4kb
OOD,file和directory
OOD, employee和 manager
9.11 三轮面试 加拿大NG
第一轮
207 —>210 —> follow up 变种
给一个课程名字,然后要return一个课程list,按照需要上课的顺序直到这节课程且包含这节课程,但不包含无关的课程
第二轮
15 minutes BQ
“Go outside your job responsibilities”:超出工作职责的情景,如何处理。
OOD: parking lot
第三轮
纯BQ
两个大问题
每一个都有很多的follow up
“Tough feedback”:你曾经收到过的严厉反馈,如何应对和改进。
“Simplify process”:你简化过的某个流程,具体的步骤和效果。
Other
top K (在职)
leetcode 678 (在职)
BQ: 前比较technical chanllenge的项目(在职)
Reference
recent oa
https://www.1point3acres.com/bbs/thread-1087123-1-1.html
https://www.1point3acres.com/bbs/thread-1086828-1-1.html
https://www.1point3acres.com/bbs/thread-1086607-1-1.html
https://www.1point3acres.com/bbs/thread-1086923-1-1.html service range
https://leetcode.com/discuss/interview-question/5540501/Amazon-oa
https://leetcode.com/discuss/interview-question/4908388/OA-Question/ create retangle
https://www.1point3acres.com/bbs/thread-1085637-1-1.html 0911 ng OA
https://www.1point3acres.com/bbs/thread-1085636-1-1.html 0911 ng OA
https://www.1point3acres.com/bbs/thread-1085483-1-1.html 0910 ng OA
https://www.1point3acres.com/bbs/thread-1085737-1-1.html 0910 ng OA
https://www.1point3acres.com/bbs/thread-1085610-1-1.html 0911 ng OA
https://www.1point3acres.com/bbs/thread-1085421-1-1.html 0911 ngOA OOD
https://www.1point3acres.com/bbs/thread-1085170-1-1.html 0909 ng OA
https://www.1point3acres.com/bbs/thread-1087428-1-1.html 08 other OA
https://www.1point3acres.com/bbs/thread-1087449-1-1.html 全职 OA
https://www.1point3acres.com/bbs/thread-1088491-1-1.html 0927 OA
work simulation
https://massiveprogramming.blogspot.com/2016/12/amazon-oa2-work-simulation-keep-walking.html
vo
https://www.1point3acres.com/bbs/thread-1086349-1-1.html Canada
https://www.1point3acres.com/bbs/thread-1086716-1-1.html 0913
https://www.1point3acres.com/bbs/thread-1085902-1-1.html 0912
https://www.1point3acres.com/bbs/thread-1084740-2-1.html 0904 SD挂
https://www.1point3acres.com/bbs/thread-1085338-1-1.html 0904 ng VO
https://www.1point3acres.com/bbs/thread-1084846-1-1.html 0906 ng VO