Pregunta de entrevista de McDonald's

Asked me to code a solution involving binary search