What is the Time complexity of the problem “Stock Span Problem” sloved using stack.
Time Complexity
It would be O(n), since every bar is added or removed from stack only once.
What is the Time complexity of the problem “Stock Span Problem” sloved using stack.
It would be O(n), since every bar is added or removed from stack only once.