Question d’entretien chez Amazon

it was a leetcode question