Domanda di colloquio di Swiggy

Leetcode medium but could answer that