Pergunta de entrevista da empresa Amazon

It was a free question masked as a standard solvable problem with a naive solution.