Pregunta de entrevista de Amazon

Coding question that required binary search