Domanda di colloquio di Amazon

Leetcode easy-medium question from Tree Stack