Domanda di colloquio di Dunzo

Sequential Question - codeforces Medium/Hard question from leetcode