Problems > Stock Span > Editorial

Stock Span — Solution & Editorial

Back to the Problem

Monotonic stack of indices with strictly decreasing prices; the span stretches back to the previous strictly-greater day.

Complexity: O(N)