nge-stack-monotonic-decreasing

Status: IN

The stack invariant in the Next Greater Element solution is strictly decreasing from bottom to top; the while loop pops all values smaller than the incoming element before pushing, enforcing this at every step.

Source: entries/2026/06/06/next-greater-element-i-solution.md

JSON