Stock Span Problem