Level: Intern
Round: Online Assessment · Type: Coding · Difficulty: 6/10 · Duration: 105 min · Interviewer: Neutral
Topics: Arrays, Greedy Algorithms
Location: Seattle, WA, US
Interview date: 2025-12-31
I completed the online assessment for an Amazon SDE Intern position. The assessment consisted of two coding questions and a Work Style Assessment (behavioral questions).
The first coding question was:
` The developers at Amazon are working on optimizing the capacity of their cloud system. In the system, there are n servers where the memory capacity of the i-th server is represented by the array memory[i]. A system always contains an even number of servers. If the system has 2x servers, then x of them will be primary servers and the other x will be backup servers. For each primary server P, there exists a backup server B where: memory[B] >= memory[P]
The system’s memory capacity is sum of the memory capacities of all primary servers.
Given n servers and an array memory, find the maximum system memory capacity that can be formed using the n servers.
Complete the function maximumCapacity in the editor below.
Return: long int: the maximum system memory capacity
Constraints: 2 <= n <= 2*10^5 `
The second coding question was:
` AWS provides scalable systems. A set of n servers are used for horizontally scaling an application. The goal is to have the computational power of the servers in non-decreasing order. To do so, you can increase the computational power of each server in any contiguous segment by x. Choose the values of x such that after the computational powers are in non-decreasing order, the sum of the x values is minimum.
Example: There are n = 5 servers and their computational power is [3, 4, 1, 6, 2]. (Add 3 units to the subarray (2, 4) and 4 units to the subarray (4, 4). The final arrangement of the servers is: [3, 4, 4, 9, 9]. The answer is 3 + 4 = 7.)
Complete the function findMinimumSum in the editor below.
findMinimumSum has the following parameter(s):
• int power[n]: the computational powers of n different servers
Return: int: the minimum possible sum of integers required to make the array non-decreasing `