Pergunta de entrevista da empresa Amazon

two coding questions of difficulty level leetcode medium