Pergunta de entrevista da empresa Amazon

I forget the question but the solution was just a modified binary search, pretty simple.