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

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

**Basic Abstractions**

Name | Summary |
---|---|

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 |

Don’t forget to push the last segment | |

Delayed initialization |

**Questions**

Num | Problem | Summary |
---|---|---|

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

2 | Examine whether the input string is valid | LeetCode: Asteroid Collision |

3 | When pushing to stack, whether delayed push | LeetCode: Decode String |

4 | Leetcode: Reverse Substrings Between Each Pair of Parentheses |

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 Remove to Make Valid Parentheses
- LeetCode: Minimum Cost Tree From Leaf Values
- LeetCode: Minimum Add to Make Parentheses Valid
- LeetCode: Mini Parser
- LeetCode: Maximum Nesting Depth of Two Valid Parentheses Strings
- LeetCode: Max Stack
- LeetCode: Longest Valid Parentheses
- LeetCode: Longest Absolute File Path
- 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: Check If Word Is Valid After Substitutions
- LeetCode: Basic Calculator III
- LeetCode: Basic Calculator
- LeetCode: Baseball Game
- LeetCode: Asteroid Collision
- LeetCode: 132 Pattern

See more blog posts.