Question d’entretien chez Bloomberg

a medium leetcode question and a hard one