I cold-emailed a recruiter, and luckily, got a call from them the next day itself.
The first round of the interview was scheduled for the following day.
Round 1 (1.5 hours) - Problem Solving / DSA
- Given a rows array (containing maximum of each row) of size n and a columns array (containing maximum of each column) of size m. The matrix is not given. Find out the maximum sum of the matrix that can be formed.
Example:
rows = [3, 6, 9]
columns = [7, 8, 9]
The matrix that can be formed to give the maximum sum is
[[3, 3, 3], [6, 6, 6], [7, 8, 9]]
Sum of this matrix = 51
Time Complexity
Brute force: O(N * M)
Optimised: O(N + M) (ignoring the sort time complexity)
Space Complexity: O(1)
- Given an array of integers, find the closest element on it's right that has a greater frequency than its own frequency.
Similar to Next Greater element, just need to store the pair of frequency and index of each element at each point in the stack.
I received positive feedback for the first round on the same day. The second round of the interview was scheduled for the very next day.
Round 2 (1.5 hours) - DSA + HM
- Parking lot design to allocateSlot and vacateSlot when a car comes in. The parking area has z floors, each floor having x rows and y columns. Entry point is at x = 0, y = 0, z = 0
For simplification, distance from entry point was taken to be x + y + z. If two slots had same distance from the entry point, then the slot with smallest floor number would be considered, followed by column number and row number.
Could be solved using priority queue and matrix of size x * y * z
The interviewer asked in-depth questions about my past projects, current work at my company, team leadership experiences, and various behavioral scenarios.
Although the interview was initially scheduled for an hour, it extended to 1.5 hours due to the engaging discussion.
I received positive feedback for this round the following day.
Verdict: Selected