Skip to content

Latest commit

 

History

History
54 lines (50 loc) · 5.43 KB

File metadata and controls

54 lines (50 loc) · 5.43 KB
title type
Stack
docs

Stack

  • 括号匹配问题及类似问题。第 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]({{< relref "/ChapterFour/0020.Valid-Parentheses.md" >}}) Easy O(log n) O(1)
42. Trapping Rain Water [Go]({{< relref "/ChapterFour/0042.Trapping-Rain-Water.md" >}}) Hard O(n) O(1) ❤️
71. Simplify Path [Go]({{< relref "/ChapterFour/0071.Simplify-Path.md" >}}) Medium O(n) O(n) ❤️
84. Largest Rectangle in Histogram [Go]({{< relref "/ChapterFour/0084.Largest-Rectangle-in-Histogram.md" >}}) Medium O(n) O(n) ❤️
94. Binary Tree Inorder Traversal [Go]({{< relref "/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md" >}}) Medium O(n) O(1)
103. Binary Tree Zigzag Level Order Traversal [Go]({{< relref "/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md" >}}) Medium O(n) O(n)
144. Binary Tree Preorder Traversal [Go]({{< relref "/ChapterFour/0144.Binary-Tree-Preorder-Traversal.md" >}}) Medium O(n) O(1)
145. Binary Tree Postorder Traversal [Go]({{< relref "/ChapterFour/0145.Binary-Tree-Postorder-Traversal.md" >}}) Hard O(n) O(1)
150. Evaluate Reverse Polish Notation [Go]({{< relref "/ChapterFour/0150.Evaluate-Reverse-Polish-Notation.md" >}}) Medium O(n) O(1)
155. Min Stack [Go]({{< relref "/ChapterFour/0155.Min-Stack.md" >}}) Easy O(n) O(n)
173. Binary Search Tree Iterator [Go]({{< relref "/ChapterFour/0173.Binary-Search-Tree-Iterator.md" >}}) Medium O(n) O(1)
224. Basic Calculator [Go]({{< relref "/ChapterFour/0224.Basic-Calculator.md" >}}) Hard O(n) O(n)
225. Implement Stack using Queues [Go]({{< relref "/ChapterFour/0225.Implement-Stack-using-Queues.md" >}}) Easy O(n) O(n)
232. Implement Queue using Stacks [Go]({{< relref "/ChapterFour/0232.Implement-Queue-using-Stacks.md" >}}) Easy O(n) O(n)
331. Verify Preorder Serialization of a Binary Tree [Go]({{< relref "/ChapterFour/0331.Verify-Preorder-Serialization-of-a-Binary-Tree.md" >}}) Medium O(n) O(1)
394. Decode String [Go]({{< relref "/ChapterFour/0394.Decode-String.md" >}}) Medium O(n) O(n)
402. Remove K Digits [Go]({{< relref "/ChapterFour/0402.Remove-K-Digits.md" >}}) Medium O(n) O(1)
456. 132 Pattern [Go]({{< relref "/ChapterFour/0456.132-Pattern.md" >}}) Medium O(n) O(n)
496. Next Greater Element I [Go]({{< relref "/ChapterFour/0496.Next-Greater-Element-I.md" >}}) Easy O(n) O(n)
503. Next Greater Element II [Go]({{< relref "/ChapterFour/0503.Next-Greater-Element-II.md" >}}) Medium O(n) O(n)
636. Exclusive Time of Functions [Go]({{< relref "/ChapterFour/0636.Exclusive-Time-of-Functions.md" >}}) Medium O(n) O(n)
682. Baseball Game [Go]({{< relref "/ChapterFour/0682.Baseball-Game.md" >}}) Easy O(n) O(n)
726. Number of Atoms [Go]({{< relref "/ChapterFour/0726.Number-of-Atoms.md" >}}) Hard O(n) O(n) ❤️
735. Asteroid Collision [Go]({{< relref "/ChapterFour/0735.Asteroid-Collision.md" >}}) Medium O(n) O(n)
739. Daily Temperatures [Go]({{< relref "/ChapterFour/0739.Daily-Temperatures.md" >}}) Medium O(n) O(n)
844. Backspace String Compare [Go]({{< relref "/ChapterFour/0844.Backspace-String-Compare.md" >}}) Easy O(n) O(n)
856. Score of Parentheses [Go]({{< relref "/ChapterFour/0856.Score-of-Parentheses.md" >}}) Medium O(n) O(n)
880. Decoded String at Index [Go]({{< relref "/ChapterFour/0880.Decoded-String-at-Index.md" >}}) Medium O(n) O(n)
895. Maximum Frequency Stack [Go]({{< relref "/ChapterFour/0895.Maximum-Frequency-Stack.md" >}}) Hard O(n) O(n)
901. Online Stock Span [Go]({{< relref "/ChapterFour/0901.Online-Stock-Span.md" >}}) Medium O(n) O(n)
907. Sum of Subarray Minimums [Go]({{< relref "/ChapterFour/0907.Sum-of-Subarray-Minimums.md" >}}) Medium O(n) O(n) ❤️
921. Minimum Add to Make Parentheses Valid [Go]({{< relref "/ChapterFour/0921.Minimum-Add-to-Make-Parentheses-Valid.md" >}}) Medium O(n) O(n)
946. Validate Stack Sequences [Go]({{< relref "/ChapterFour/0946.Validate-Stack-Sequences.md" >}}) Medium O(n) O(n)
1003. Check If Word Is Valid After Substitutions [Go]({{< relref "/ChapterFour/1003.Check-If-Word-Is-Valid-After-Substitutions.md" >}}) Medium O(n) O(1)
1019. Next Greater Node In Linked List [Go]({{< relref "/ChapterFour/1019.Next-Greater-Node-In-Linked-List.md" >}}) Medium O(n) O(1)
1021. Remove Outermost Parentheses [Go]({{< relref "/ChapterFour/1021.Remove-Outermost-Parentheses.md" >}}) Medium O(n) O(1)
1047. Remove All Adjacent Duplicates In String [Go]({{< relref "/ChapterFour/1047.Remove-All-Adjacent-Duplicates-In-String.md" >}}) Medium O(n) O(1)
--------------------------------------- ----------------------------- -------------------------- ----------------------- ----------- --------