Level: Intern
Round: Online Assessment · Type: Coding · Difficulty: 5/10 · Duration: 60 min · Interviewer: Unfriendly
Topics: Hash Table, Sorting, Arrays
Location: Seattle, WA, US
Interview date: 2025-12-27
I completed an online assessment with two coding questions.
I had an online assessment consisting of two coding questions.
Question 1: Given an integer array where each element represents an error code, reorder the error codes based on priority. Priority rules:
My solution: I used a hash table and a custom key for sorting.
collections.Counter to count frequencies.sort() with a key set to (frequency, error code value).Question 2: Given a sequence $A = [a_1, a_2, ..., a_n]$ of length $n$.
Select any closed interval [i, j] (where $1 < i < j < n$) and a positive integer x, increment all elements a_k within that interval by x. The final sequence must satisfy a_i < a_i+1 (non-decreasing sequence). Minimize the cumulative sum of x across all operations
My Solution: The core idea is that the minimum total sum of x is equal to the sum of all differences where a previous element is greater than the following element. By traversing the array and comparing a[i] and a[i-1]: If a[i] < a[i-1], then there is a 'pit' that needs to be filled. The increment x = power[i-1] - power[i]. Sum all x values to get the final answer.