Pregunta de entrevista de Dunzo

Sequential Question - codeforces Medium/Hard question from leetcode