Screening Round :
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]
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.
Solved using sliding window.
Verdict : Not recieved feedback yet, but interviewer was very friendly the round went pretty well and I gave approach and code of both the questions in the required time.