Concept Flow - Stock Span Problem Using Stack
Start with empty stack
For each day's price
While stack not empty and top price <= current price
Pop stack
Calculate span: current index - top of stack index
Push current day index onto stack
Repeat for next day
End: return span array
We use a stack to keep indexes of days with higher prices. For each day, pop lower prices, calculate span, then push current day.
