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

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

**Questions**

Name | Example |
---|---|

Push items to stack VS push indices | Leetcode: Reverse Substrings Between Each Pair of Parentheses |

Push items to stack VS push string | Leetcode: Reverse Substrings Between Each Pair of Parentheses |

Different types of elements in the stack | Leetcode: Number of Atoms |

When pushing items to stack, whether we need delayed push? | Leetcode: Decode String |

Don’t forget to push the last token | |

Delayed initialization | |

Recursive deletion during pushing process | Leetcode: Verify Preorder Serialization of a Binary Tree |

Examine whether the input string is valid | Leetcode: Asteroid Collision |

See all stack problems: #stack

- Review: Stack Problems
- LintCode: MinimumString
- LintCode: Input Stream
- Leetcode: Verify Preorder Serialization of a Binary Tree
- Leetcode: Validate Stack Sequences
- Leetcode: Valid Parentheses
- Leetcode: Ternary Expression Parser
- Leetcode: Score of Parentheses
- Leetcode: Remove All Adjacent Duplicates in String II
- Leetcode: Number of Atoms
- Leetcode: Minimum Add to Make Parentheses Valid
- Leetcode: Mini Parser
- Leetcode: Max Stack
- Leetcode: Longest Valid Parentheses
- Leetcode: Exclusive Time of Functions
- 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
- Leetcode: 132 Pattern

See more blog_posts.