Question d’entretien chez Amazon

Two questions at Leetcode medium difficulty