Pregunta de entrevista de Uber

The question was a double binary search.