Pergunta de entrevista da empresa Amazon

Two programming tests, randomly determined.