← All questions
EasyCoding
Remove All Adjacent Duplicates In String
Asked at
Swiggy
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
- 01Use output as a stack
- 02Read each character
- 03Pop equal top
- 04Otherwise push
- 05Return stack contents
Reference answer
Then expect these follow-ups
Why is one left-to-right pass sufficient?
Tests: correctness reasoning
How does the k-duplicate variant change?
Tests: constraint adaptation
Hiring now
Swiggy has 152 open roles right now
landed applies to roles like these for you, on each company’s own site, with answers written for the role.
Get 5x interviews10 free auto-applies. No card.
Content Lead
Mumbai, MH, India
Sales Manager I
Kolhapur, MH, India
Assistant Manager- Finance
Bengaluru, KA, India
Next question