Panda Guru LogoPanda
Guru

Google | Phone Screen | L3

Screening Round

Questions:

  1. Given an array of size N, find the maximum length of non-decreasing subarray:
[0, 7, 3, 10, 2, 4, 6, 8, 0, 9, -20, 4]

ans = 4, [2, 4, 6, 8]

  1. Follow up: You can choose any one index and change its value to any number that you like. What will be the longest non-decreasing subarray now: In the same example as before, the answer would now be:
ans = 6, [2, 4, 6, 8, 0, 9], by changing 0 -> 8 so the subarray becomes non-decreasing.
Candidate's Approach

Solved using sliding window.

Interviewer's Feedback

No feedback provided.