DoorDash Interview Question

A LC question related to binary search