Nearest Smaller to the Left — Solution & Editorial
Monotonic stack of positions with increasing values: pop everything ≥ the current element; the survivor (if any) is the answer.
Complexity: O(N)
Monotonic stack of positions with increasing values: pop everything ≥ the current element; the survivor (if any) is the answer.
Complexity: O(N)