Pergunta de entrevista da empresa Amazon

Two leetcode problems (easy to medium) difficulty