Pergunta de entrevista da empresa Amazon

Coding question that required binary search