← 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 3 weeks, 1 day ago

This should be marked as the editorial approach honestly.

bhavana_34 3 weeks ago

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

deepikakap7 2 weeks, 3 days ago

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

Sign in to reply.