mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-06 09:23:19 +08:00
8.8 KiB
8.8 KiB
title | type | weight |
---|---|---|
2.05 ✅ Stack | docs | 5 |
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 题。
No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity | Favorite | Acceptance |
---|---|---|---|---|---|---|---|
0020 | Valid Parentheses | [Go]({{< relref "/ChapterFour/0001~0099/0020.Valid-Parentheses.md" >}}) | Easy | O(log n) | O(1) | 40.5% | |
0032 | Longest Valid Parentheses | [Go]({{< relref "/ChapterFour/0001~0099/0032.Longest-Valid-Parentheses.md" >}}) | Hard | 30.7% | |||
0042 | Trapping Rain Water | [Go]({{< relref "/ChapterFour/0001~0099/0042.Trapping-Rain-Water.md" >}}) | Hard | O(n) | O(1) | ❤️ | 54.3% |
0071 | Simplify Path | [Go]({{< relref "/ChapterFour/0001~0099/0071.Simplify-Path.md" >}}) | Medium | O(n) | O(n) | ❤️ | 36.4% |
0084 | Largest Rectangle in Histogram | [Go]({{< relref "/ChapterFour/0001~0099/0084.Largest-Rectangle-in-Histogram.md" >}}) | Hard | O(n) | O(n) | ❤️ | 39.0% |
0094 | Binary Tree Inorder Traversal | [Go]({{< relref "/ChapterFour/0001~0099/0094.Binary-Tree-Inorder-Traversal.md" >}}) | Easy | O(n) | O(1) | 68.9% | |
0114 | Flatten Binary Tree to Linked List | [Go]({{< relref "/ChapterFour/0100~0199/0114.Flatten-Binary-Tree-to-Linked-List.md" >}}) | Medium | 55.7% | |||
0143 | Reorder List | [Go]({{< relref "/ChapterFour/0100~0199/0143.Reorder-List.md" >}}) | Medium | 44.1% | |||
0144 | Binary Tree Preorder Traversal | [Go]({{< relref "/ChapterFour/0100~0199/0144.Binary-Tree-Preorder-Traversal.md" >}}) | Easy | O(n) | O(1) | 60.3% | |
0145 | Binary Tree Postorder Traversal | [Go]({{< relref "/ChapterFour/0100~0199/0145.Binary-Tree-Postorder-Traversal.md" >}}) | Easy | O(n) | O(1) | 61.3% | |
0150 | Evaluate Reverse Polish Notation | [Go]({{< relref "/ChapterFour/0100~0199/0150.Evaluate-Reverse-Polish-Notation.md" >}}) | Medium | O(n) | O(1) | 40.7% | |
0155 | Min Stack | [Go]({{< relref "/ChapterFour/0100~0199/0155.Min-Stack.md" >}}) | Easy | O(n) | O(n) | 48.8% | |
0173 | Binary Search Tree Iterator | [Go]({{< relref "/ChapterFour/0100~0199/0173.Binary-Search-Tree-Iterator.md" >}}) | Medium | O(n) | O(1) | 63.4% | |
0224 | Basic Calculator | [Go]({{< relref "/ChapterFour/0200~0299/0224.Basic-Calculator.md" >}}) | Hard | O(n) | O(n) | 39.6% | |
0225 | Implement Stack using Queues | [Go]({{< relref "/ChapterFour/0200~0299/0225.Implement-Stack-using-Queues.md" >}}) | Easy | O(n) | O(n) | 50.4% | |
0227 | Basic Calculator II | [Go]({{< relref "/ChapterFour/0200~0299/0227.Basic-Calculator-II.md" >}}) | Medium | 40.0% | |||
0232 | Implement Queue using Stacks | [Go]({{< relref "/ChapterFour/0200~0299/0232.Implement-Queue-using-Stacks.md" >}}) | Easy | O(n) | O(n) | 55.4% | |
0234 | Palindrome Linked List | [Go]({{< relref "/ChapterFour/0200~0299/0234.Palindrome-Linked-List.md" >}}) | Easy | 44.6% | |||
0331 | Verify Preorder Serialization of a Binary Tree | [Go]({{< relref "/ChapterFour/0300~0399/0331.Verify-Preorder-Serialization-of-a-Binary-Tree.md" >}}) | Medium | O(n) | O(1) | 43.3% | |
0341 | Flatten Nested List Iterator | [Go]({{< relref "/ChapterFour/0300~0399/0341.Flatten-Nested-List-Iterator.md" >}}) | Medium | 57.5% | |||
0385 | Mini Parser | [Go]({{< relref "/ChapterFour/0300~0399/0385.Mini-Parser.md" >}}) | Medium | 35.3% | |||
0394 | Decode String | [Go]({{< relref "/ChapterFour/0300~0399/0394.Decode-String.md" >}}) | Medium | O(n) | O(n) | 54.7% | |
0402 | Remove K Digits | [Go]({{< relref "/ChapterFour/0400~0499/0402.Remove-K-Digits.md" >}}) | Medium | O(n) | O(1) | 28.9% | |
0445 | Add Two Numbers II | [Go]({{< relref "/ChapterFour/0400~0499/0445.Add-Two-Numbers-II.md" >}}) | Medium | 57.8% | |||
0456 | 132 Pattern | [Go]({{< relref "/ChapterFour/0400~0499/0456.132-Pattern.md" >}}) | Medium | O(n) | O(n) | 30.7% | |
0496 | Next Greater Element I | [Go]({{< relref "/ChapterFour/0400~0499/0496.Next-Greater-Element-I.md" >}}) | Easy | O(n) | O(n) | 68.6% | |
0503 | Next Greater Element II | [Go]({{< relref "/ChapterFour/0500~0599/0503.Next-Greater-Element-II.md" >}}) | Medium | O(n) | O(n) | 60.7% | |
0581 | Shortest Unsorted Continuous Subarray | [Go]({{< relref "/ChapterFour/0500~0599/0581.Shortest-Unsorted-Continuous-Subarray.md" >}}) | Medium | 33.6% | |||
0589 | N-ary Tree Preorder Traversal | [Go]({{< relref "/ChapterFour/0500~0599/0589.N-ary-Tree-Preorder-Traversal.md" >}}) | Easy | 75.2% | |||
0636 | Exclusive Time of Functions | [Go]({{< relref "/ChapterFour/0600~0699/0636.Exclusive-Time-of-Functions.md" >}}) | Medium | O(n) | O(n) | 58.0% | |
0682 | Baseball Game | [Go]({{< relref "/ChapterFour/0600~0699/0682.Baseball-Game.md" >}}) | Easy | O(n) | O(n) | 68.7% | |
0726 | Number of Atoms | [Go]({{< relref "/ChapterFour/0700~0799/0726.Number-of-Atoms.md" >}}) | Hard | O(n) | O(n) | ❤️ | 51.5% |
0735 | Asteroid Collision | [Go]({{< relref "/ChapterFour/0700~0799/0735.Asteroid-Collision.md" >}}) | Medium | O(n) | O(n) | 44.1% | |
0739 | Daily Temperatures | [Go]({{< relref "/ChapterFour/0700~0799/0739.Daily-Temperatures.md" >}}) | Medium | O(n) | O(n) | 66.1% | |
0844 | Backspace String Compare | [Go]({{< relref "/ChapterFour/0800~0899/0844.Backspace-String-Compare.md" >}}) | Easy | O(n) | O(n) | 47.4% | |
0856 | Score of Parentheses | [Go]({{< relref "/ChapterFour/0800~0899/0856.Score-of-Parentheses.md" >}}) | Medium | O(n) | O(n) | 65.5% | |
0880 | Decoded String at Index | [Go]({{< relref "/ChapterFour/0800~0899/0880.Decoded-String-at-Index.md" >}}) | Medium | O(n) | O(n) | 28.2% | |
0895 | Maximum Frequency Stack | [Go]({{< relref "/ChapterFour/0800~0899/0895.Maximum-Frequency-Stack.md" >}}) | Hard | O(n) | O(n) | 64.2% | |
0897 | Increasing Order Search Tree | [Go]({{< relref "/ChapterFour/0800~0899/0897.Increasing-Order-Search-Tree.md" >}}) | Easy | 75.6% | |||
0901 | Online Stock Span | [Go]({{< relref "/ChapterFour/0900~0999/0901.Online-Stock-Span.md" >}}) | Medium | O(n) | O(n) | 62.4% | |
0907 | Sum of Subarray Minimums | [Go]({{< relref "/ChapterFour/0900~0999/0907.Sum-of-Subarray-Minimums.md" >}}) | Medium | O(n) | O(n) | ❤️ | 33.0% |
0921 | Minimum Add to Make Parentheses Valid | [Go]({{< relref "/ChapterFour/0900~0999/0921.Minimum-Add-to-Make-Parentheses-Valid.md" >}}) | Medium | O(n) | O(n) | 77.0% | |
0946 | Validate Stack Sequences | [Go]({{< relref "/ChapterFour/0900~0999/0946.Validate-Stack-Sequences.md" >}}) | Medium | O(n) | O(n) | 64.9% | |
1003 | Check If Word Is Valid After Substitutions | [Go]({{< relref "/ChapterFour/1000~1099/1003.Check-If-Word-Is-Valid-After-Substitutions.md" >}}) | Medium | O(n) | O(1) | 57.4% | |
1006 | Clumsy Factorial | [Go]({{< relref "/ChapterFour/1000~1099/1006.Clumsy-Factorial.md" >}}) | Medium | 54.4% | |||
1019 | Next Greater Node In Linked List | [Go]({{< relref "/ChapterFour/1000~1099/1019.Next-Greater-Node-In-Linked-List.md" >}}) | Medium | O(n) | O(1) | 59.3% | |
1021 | Remove Outermost Parentheses | [Go]({{< relref "/ChapterFour/1000~1099/1021.Remove-Outermost-Parentheses.md" >}}) | Easy | O(n) | O(1) | 79.5% | |
1047 | Remove All Adjacent Duplicates In String | [Go]({{< relref "/ChapterFour/1000~1099/1047.Remove-All-Adjacent-Duplicates-In-String.md" >}}) | Easy | O(n) | O(1) | 71.2% | |
1111 | Maximum Nesting Depth of Two Valid Parentheses Strings | [Go]({{< relref "/ChapterFour/1100~1199/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md" >}}) | Medium | 72.5% | |||
1190 | Reverse Substrings Between Each Pair of Parentheses | [Go]({{< relref "/ChapterFour/1100~1199/1190.Reverse-Substrings-Between-Each-Pair-of-Parentheses.md" >}}) | Medium | 65.3% | |||
1209 | Remove All Adjacent Duplicates in String II | [Go]({{< relref "/ChapterFour/1200~1299/1209.Remove-All-Adjacent-Duplicates-in-String-II.md" >}}) | Medium | 56.1% | |||
1249 | Minimum Remove to Make Valid Parentheses | [Go]({{< relref "/ChapterFour/1200~1299/1249.Minimum-Remove-to-Make-Valid-Parentheses.md" >}}) | Medium | 65.1% | |||
1614 | Maximum Nesting Depth of the Parentheses | [Go]({{< relref "/ChapterFour/1600~1699/1614.Maximum-Nesting-Depth-of-the-Parentheses.md" >}}) | Easy | 82.8% | |||
1653 | Minimum Deletions to Make String Balanced | [Go]({{< relref "/ChapterFour/1600~1699/1653.Minimum-Deletions-to-Make-String-Balanced.md" >}}) | Medium | 54.0% | |||
1673 | Find the Most Competitive Subsequence | [Go]({{< relref "/ChapterFour/1600~1699/1673.Find-the-Most-Competitive-Subsequence.md" >}}) | Medium | 47.3% | |||
1700 | Number of Students Unable to Eat Lunch | [Go]({{< relref "/ChapterFour/1700~1799/1700.Number-of-Students-Unable-to-Eat-Lunch.md" >}}) | Easy | 67.6% | |||
------------ | ------------------------------------------------------- | ------- | ---------------- | --------------- | ------------- | ------------- | ------------- |