Stack Pattern
When do we use the stack pattern?
Answer
We use stacks when:
New elements depend on previously added elements
(Evaluate Reverse Polish Notation, Min Stack)
The most recent element must be handled first (Valid Parentheses, Car Fleet)
The most recent element may need to be removed (Baseball Game)