Problem 1019 · Medium
Scan the list once with a monotonic stack of positions still waiting for a larger value.
Open the interactive visualisation