Question DSA-STK-0074
HardHow does the stack-based algorithm for the 'stock span' problem work?
- A.
It sorts the prices
- B.
It keeps indexes of days with higher prices; each day pops lower ones and its span is the distance to the remaining top
- C.
Sign up free to see the answer and a step-by-step explanation.