Panda Guru LogoPanda
Guru

Amazon OA Question | 2024

Round 1

Questions: Process an array, arr, using two pointers, P1 and P2, and an integer, segSize. Pick an integer to test for segSize, then start with P1 = 0 and P2 = 1. Compare the value at arr[P1] with all of the elements in a subarray. The subarray starts at arr[P2] and includes segSize elements or it reaches the end of arr. If arr[P1] is greater or equal in all cases, increment P1 by 1, increment P2 by segSize, and repeat the process. Do this until the subarray including the last element of arr has been processed. Determine the minimum value of segSize that allows the entire array to be processed. Return this minimum step value or -1 if it is not possible.

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.