Pergunta de entrevista da empresa Amazon

Same as Leetcode coding problem.