Pergunta de entrevista da empresa Amazon

It was a generic two-pointer problem.