Steps to Make Array Non-decreasing
Each element is removed after as many rounds as the longest chain of smaller predecessors before it; a monotonic stack finds it.
Each element is removed after as many rounds as the longest chain of smaller predecessors before it; a monotonic stack finds it.