The concept of stack is simple. But the problem could be tricky.

It’s not difficult, but might involve lots of details.

Key points:

- When pushing items to stack, whether we need delayed push? (See Decode String)
- Don’t forget to push the last token

Typical Problems:

- Delayed initialization:
- Recursive deletion during pushing process

Verify Preorder Serialization of a Binary Tree - Examine whether the input string is valid

Verify Preorder Serialization of a Binary Tree

Asteroid Collision - Keep the loop

The most impressive problems to me:

See all stack problems: #stack

- Review: Stack Problems
- LintCode: MinimumString
- LintCode: Input Stream
- Leetcode: Verify Preorder Serialization of a Binary Tree
- Leetcode: Ternary Expression Parser
- Leetcode: Score of Parentheses
- Leetcode: Number of Atoms
- Leetcode: Minimum Add to Make Parentheses Valid
- Leetcode: Mini Parser
- Leetcode: Evaluate Reverse Polish Notation
- Leetcode: Decoded String at Index
- Leetcode: Decode String
- Leetcode: Construct Binary Tree from String
- Leetcode: Basic Calculator III
- Leetcode: Basic Calculator
- Leetcode: Baseball Game
- Leetcode: Asteroid Collision

See more blog_posts.

Share It, If You Like It.