Pregunta de entrevista de Apple

Got asked a binary search iterator question from leetcode, got asked both the recursive and the iterative approach