← Discussions on Valid Parentheses
C chaitanya_57
24 Sep 2026, 11:50

Asked in my BrowserStack OA last week.

A monotonic stack is the trick: pop while the current element breaks the order, and the popped elements have just found their answer.

3 replies

kunalsax8 2 months, 1 week ago

This should be marked as the editorial approach honestly.

bhavana_34 2 months ago

Nice. Got asked a variant of this in an interview.

deepikakap7 2 months ago

Nice. Got asked a variant of this in an interview.

Sign in to reply.