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.