Attention
- Comparing Integer, Using _Integer.compareTo and _Integer.equals()
思路
- Comparing min to the new added number. O(n) after pop().
- Use linked list, create a node class.
- Use one more stack to store min
- Bug: Don’t forget to do pop in min stack also
- If a stack is empty, you can’t do pop() and peek(). An emptyStackException error occurs.