Panda Guru LogoPanda
Guru

Amazon | SDE II | OA

Round 1

Questions: Given orders and shifts, return pending orders at the end of each shift.

Input:

n=5, orderProcessingTime=[2,4,5,1,1], m=5, shiftDuration=[1,5,1,5,2]

Output:

[5,3,3,1,0]

If an order is not fully processed by the end of a shift, it will be continued in the next shift.

Input:

n=5, orderProcessingTime=[1,2,4,1,2], m=5, shiftDuration=[3,10,1,1,1]

Output:

[3,0,4,4,3]
Candidate's Approach

Two pointers, one on the order processing time and the other on the shift. For every shift, check if we can finish the order and move the pointers accordingly. 11 out of 15 test cases passed, while others resulted in TLE.

Interviewer's Feedback

No feedback provided.