Level: Intern
Round: Online Assessment · Type: Coding · Difficulty: 3/10 · Duration: 60 min · Interviewer: Neutral
Topics: Arrays, Greedy Algorithms
Location: Seattle, WA, US
Interview date: 2025-12-19
Got offer: False
I applied online and received an Online Assessment (OA). I completed the test, and all test cases passed. I received a rejection email shortly after, and I'm not sure why.
The OA consisted of two coding questions:
Non-decreasing Array: Given an array power, I needed to perform an operation repeatedly: select a continuous range and increment each element in that range by 1. The goal was to make the entire array non-decreasing (power[i] <= power[i+1]). The question asked for the minimum total number of operations required to achieve this condition.
Server Pairing: Given an array memory, where each element represents the memory of a server, I had to divide the selected servers into pairs (primary and backup). Each pair must satisfy the condition that the backup server's memory is greater than or equal to the primary server's memory. The objective was to maximize the sum of memory values of all primary servers. Each server could only be used once and could not belong to two pairs simultaneously.
My approach: For the first question, I used a greedy approach, iterating through the array and calculating the difference needed to make each element greater than or equal to the previous one. For the second question, I sorted the array and paired servers from the largest to smallest, ensuring the backup had enough memory for its primary server.
LeetCode similar: LeetCode 1827