Question d’entretien chez Amazon

Leetcode medium-hard level question for the OA