Domanda di colloquio di Apple

Got asked a binary search leetcode question.