Domanda di colloquio di Bloomberg

Hackerrank question related to data structures and algorithms