Domanda di colloquio di Amazon

Two leetcode problems (easy to medium) difficulty