Question d’entretien chez Amazon

Easy-Medium Leetcode. The debugging was similar format to the examples provided.