Pergunta de entrevista da empresa Amazon

Both coding questions were easy