Discover more content...

Discover more content...

Enter some keywords in the search box above, we will do our best to offer you relevant results.


We're sorry!

Sorry about that!

We couldn't find any results for your search. Please try again with another keywords.

LeetCode 分类刷题 —— Stack

Stack 的 Tips:

  • 括号匹配问题及类似问题。第 20 题,第 921 题,第 1021 题。
  • 栈的基本 pop 和 push 操作。第 71 题,第 150 题,第 155 题,第 224 题,第 225 题,第 232 题,第 946 题,第 1047 题。
  • 利用栈进行编码问题。第 394 题,第 682 题,第 856 题,第 880 题。
  • 单调栈利用栈维护一个单调递增或者递减的下标数组。第 84 题,第 456 题,第 496 题,第 503 题,第 739 题,第 901 题,第 907 题,第 1019 题。
Title Solution Difficulty Time Space 收藏
20. Valid Parentheses Go Easy O(log n) O(1)
42. Trapping Rain Water Go Hard O(n) O(1) ❤️
71. Simplify Path Go Medium O(n) O(n) ❤️
84. Largest Rectangle in Histogram Go Medium O(n) O(n) ❤️
94. Binary Tree Inorder Traversal Go Medium O(n) O(1)
103. Binary Tree Zigzag Level Order Traversal Go Medium O(n) O(n)
144. Binary Tree Preorder Traversal Go Medium O(n) O(1)
145. Binary Tree Postorder Traversal Go Hard O(n) O(1)
150. Evaluate Reverse Polish Notation Go Medium O(n) O(1)
155. Min Stack Go Easy O(n) O(n)
173. Binary Search Tree Iterator Go Medium O(n) O(1)
224. Basic Calculator Go Hard O(n) O(n)
225. Implement Stack using Queues Go Easy O(n) O(n)
232. Implement Queue using Stacks Go Easy O(n) O(n)
331. Verify Preorder Serialization of a Binary Tree Go Medium O(n) O(1)
394. Decode String Go Medium O(n) O(n)
402. Remove K Digits Go Medium O(n) O(1)
456. 132 Pattern Go Medium O(n) O(n)
496. Next Greater Element I Go Easy O(n) O(n)
503. Next Greater Element II Go Medium O(n) O(n)
636. Exclusive Time of Functions Go Medium O(n) O(n)
682. Baseball Game Go Easy O(n) O(n)
726. Number of Atoms Go Hard O(n) O(n) ❤️
735. Asteroid Collision Go Medium O(n) O(n)
739. Daily Temperatures Go Medium O(n) O(n)
844. Backspace String Compare Go Easy O(n) O(n)
856. Score of Parentheses Go Medium O(n) O(n)
880. Decoded String at Index Go Medium O(n) O(n)
895. Maximum Frequency Stack Go Hard O(n) O(n)
901. Online Stock Span Go Medium O(n) O(n)
907. Sum of Subarray Minimums Go Medium O(n) O(n) ❤️
921. Minimum Add to Make Parentheses Valid Go Medium O(n) O(n)
946. Validate Stack Sequences Go Medium O(n) O(n)
1003. Check If Word Is Valid After Substitutions Go Medium O(n) O(1)
1019. Next Greater Node In Linked List Go Medium O(n) O(1)
1021. Remove Outermost Parentheses Go Medium O(n) O(1)
1047. Remove All Adjacent Duplicates In String Go Medium O(n) O(1)