Domanda di colloquio di Bloomberg

I was a question from leetcode.