Question d’entretien chez Bloomberg

Leetcode question and about medium difficulty.