Back to Leetcode Go

2.05 ✅ Stack

website/content/ChapterTwo/Stack.md

1.7.18.9 KB
Original Source

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.TitleSolutionDifficultyTimeComplexitySpaceComplexityFavoriteAcceptance
0020Valid Parentheses[Go]({{< relref "/ChapterFour/0001~0099/0020.Valid-Parentheses.md" >}})EasyO(log n)O(1)40.2%
0032Longest Valid Parentheses[Go]({{< relref "/ChapterFour/0001~0099/0032.Longest-Valid-Parentheses.md" >}})Hard32.8%
0042Trapping Rain Water[Go]({{< relref "/ChapterFour/0001~0099/0042.Trapping-Rain-Water.md" >}})HardO(n)O(1)❤️59.2%
0071Simplify Path[Go]({{< relref "/ChapterFour/0001~0099/0071.Simplify-Path.md" >}})MediumO(n)O(n)❤️39.3%
0084Largest Rectangle in Histogram[Go]({{< relref "/ChapterFour/0001~0099/0084.Largest-Rectangle-in-Histogram.md" >}})HardO(n)O(n)❤️42.6%
0094Binary Tree Inorder Traversal[Go]({{< relref "/ChapterFour/0001~0099/0094.Binary-Tree-Inorder-Traversal.md" >}})EasyO(n)O(1)73.8%
0114Flatten Binary Tree to Linked List[Go]({{< relref "/ChapterFour/0100~0199/0114.Flatten-Binary-Tree-to-Linked-List.md" >}})Medium61.8%
0143Reorder List[Go]({{< relref "/ChapterFour/0100~0199/0143.Reorder-List.md" >}})Medium52.5%
0144Binary Tree Preorder Traversal[Go]({{< relref "/ChapterFour/0100~0199/0144.Binary-Tree-Preorder-Traversal.md" >}})EasyO(n)O(1)66.8%
0145Binary Tree Postorder Traversal[Go]({{< relref "/ChapterFour/0100~0199/0145.Binary-Tree-Postorder-Traversal.md" >}})EasyO(n)O(1)67.9%
0150Evaluate Reverse Polish Notation[Go]({{< relref "/ChapterFour/0100~0199/0150.Evaluate-Reverse-Polish-Notation.md" >}})MediumO(n)O(1)45.7%
0155Min Stack[Go]({{< relref "/ChapterFour/0100~0199/0155.Min-Stack.md" >}})MediumO(n)O(n)52.3%
0173Binary Search Tree Iterator[Go]({{< relref "/ChapterFour/0100~0199/0173.Binary-Search-Tree-Iterator.md" >}})MediumO(n)O(1)69.7%
0224Basic Calculator[Go]({{< relref "/ChapterFour/0200~0299/0224.Basic-Calculator.md" >}})HardO(n)O(n)42.4%
0225Implement Stack using Queues[Go]({{< relref "/ChapterFour/0200~0299/0225.Implement-Stack-using-Queues.md" >}})EasyO(n)O(n)58.6%
0227Basic Calculator II[Go]({{< relref "/ChapterFour/0200~0299/0227.Basic-Calculator-II.md" >}})Medium42.4%
0232Implement Queue using Stacks[Go]({{< relref "/ChapterFour/0200~0299/0232.Implement-Queue-using-Stacks.md" >}})EasyO(n)O(n)63.2%
0234Palindrome Linked List[Go]({{< relref "/ChapterFour/0200~0299/0234.Palindrome-Linked-List.md" >}})Easy50.2%
0331Verify Preorder Serialization of a Binary Tree[Go]({{< relref "/ChapterFour/0300~0399/0331.Verify-Preorder-Serialization-of-a-Binary-Tree.md" >}})MediumO(n)O(1)44.6%
0341Flatten Nested List Iterator[Go]({{< relref "/ChapterFour/0300~0399/0341.Flatten-Nested-List-Iterator.md" >}})Medium61.8%
0385Mini Parser[Go]({{< relref "/ChapterFour/0300~0399/0385.Mini-Parser.md" >}})Medium36.9%
0394Decode String[Go]({{< relref "/ChapterFour/0300~0399/0394.Decode-String.md" >}})MediumO(n)O(n)57.9%
0402Remove K Digits[Go]({{< relref "/ChapterFour/0400~0499/0402.Remove-K-Digits.md" >}})MediumO(n)O(1)30.6%
0445Add Two Numbers II[Go]({{< relref "/ChapterFour/0400~0499/0445.Add-Two-Numbers-II.md" >}})Medium59.6%
0456132 Pattern[Go]({{< relref "/ChapterFour/0400~0499/0456.132-Pattern.md" >}})MediumO(n)O(n)32.4%
0496Next Greater Element I[Go]({{< relref "/ChapterFour/0400~0499/0496.Next-Greater-Element-I.md" >}})EasyO(n)O(n)71.4%
0503Next Greater Element II[Go]({{< relref "/ChapterFour/0500~0599/0503.Next-Greater-Element-II.md" >}})MediumO(n)O(n)63.2%
0581Shortest Unsorted Continuous Subarray[Go]({{< relref "/ChapterFour/0500~0599/0581.Shortest-Unsorted-Continuous-Subarray.md" >}})Medium36.4%
0589N-ary Tree Preorder Traversal[Go]({{< relref "/ChapterFour/0500~0599/0589.N-ary-Tree-Preorder-Traversal.md" >}})Easy75.9%
0636Exclusive Time of Functions[Go]({{< relref "/ChapterFour/0600~0699/0636.Exclusive-Time-of-Functions.md" >}})MediumO(n)O(n)61.2%
0682Baseball Game[Go]({{< relref "/ChapterFour/0600~0699/0682.Baseball-Game.md" >}})EasyO(n)O(n)74.3%
0726Number of Atoms[Go]({{< relref "/ChapterFour/0700~0799/0726.Number-of-Atoms.md" >}})HardO(n)O(n)❤️52.1%
0735Asteroid Collision[Go]({{< relref "/ChapterFour/0700~0799/0735.Asteroid-Collision.md" >}})MediumO(n)O(n)44.4%
0739Daily Temperatures[Go]({{< relref "/ChapterFour/0700~0799/0739.Daily-Temperatures.md" >}})MediumO(n)O(n)66.3%
0844Backspace String Compare[Go]({{< relref "/ChapterFour/0800~0899/0844.Backspace-String-Compare.md" >}})EasyO(n)O(n)48.1%
0853Car Fleet[Go]({{< relref "/ChapterFour/0800~0899/0853.Car-Fleet.md" >}})Medium50.3%
0856Score of Parentheses[Go]({{< relref "/ChapterFour/0800~0899/0856.Score-of-Parentheses.md" >}})MediumO(n)O(n)64.8%
0880Decoded String at Index[Go]({{< relref "/ChapterFour/0800~0899/0880.Decoded-String-at-Index.md" >}})MediumO(n)O(n)28.3%
0895Maximum Frequency Stack[Go]({{< relref "/ChapterFour/0800~0899/0895.Maximum-Frequency-Stack.md" >}})HardO(n)O(n)66.6%
0897Increasing Order Search Tree[Go]({{< relref "/ChapterFour/0800~0899/0897.Increasing-Order-Search-Tree.md" >}})Easy78.4%
0901Online Stock Span[Go]({{< relref "/ChapterFour/0900~0999/0901.Online-Stock-Span.md" >}})MediumO(n)O(n)65.2%
0907Sum of Subarray Minimums[Go]({{< relref "/ChapterFour/0900~0999/0907.Sum-of-Subarray-Minimums.md" >}})MediumO(n)O(n)❤️35.8%
0921Minimum Add to Make Parentheses Valid[Go]({{< relref "/ChapterFour/0900~0999/0921.Minimum-Add-to-Make-Parentheses-Valid.md" >}})MediumO(n)O(n)75.8%
0946Validate Stack Sequences[Go]({{< relref "/ChapterFour/0900~0999/0946.Validate-Stack-Sequences.md" >}})MediumO(n)O(n)67.7%
1003Check If Word Is Valid After Substitutions[Go]({{< relref "/ChapterFour/1000~1099/1003.Check-If-Word-Is-Valid-After-Substitutions.md" >}})MediumO(n)O(1)58.2%
1006Clumsy Factorial[Go]({{< relref "/ChapterFour/1000~1099/1006.Clumsy-Factorial.md" >}})Medium55.4%
1019Next Greater Node In Linked List[Go]({{< relref "/ChapterFour/1000~1099/1019.Next-Greater-Node-In-Linked-List.md" >}})MediumO(n)O(1)59.9%
1021Remove Outermost Parentheses[Go]({{< relref "/ChapterFour/1000~1099/1021.Remove-Outermost-Parentheses.md" >}})EasyO(n)O(1)80.6%
1047Remove All Adjacent Duplicates In String[Go]({{< relref "/ChapterFour/1000~1099/1047.Remove-All-Adjacent-Duplicates-In-String.md" >}})EasyO(n)O(1)69.7%
1111Maximum Nesting Depth of Two Valid Parentheses Strings[Go]({{< relref "/ChapterFour/1100~1199/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md" >}})Medium73.0%
1190Reverse Substrings Between Each Pair of Parentheses[Go]({{< relref "/ChapterFour/1100~1199/1190.Reverse-Substrings-Between-Each-Pair-of-Parentheses.md" >}})Medium65.9%
1209Remove All Adjacent Duplicates in String II[Go]({{< relref "/ChapterFour/1200~1299/1209.Remove-All-Adjacent-Duplicates-in-String-II.md" >}})Medium56.2%
1249Minimum Remove to Make Valid Parentheses[Go]({{< relref "/ChapterFour/1200~1299/1249.Minimum-Remove-to-Make-Valid-Parentheses.md" >}})Medium65.8%
1614Maximum Nesting Depth of the Parentheses[Go]({{< relref "/ChapterFour/1600~1699/1614.Maximum-Nesting-Depth-of-the-Parentheses.md" >}})Easy82.3%
1653Minimum Deletions to Make String Balanced[Go]({{< relref "/ChapterFour/1600~1699/1653.Minimum-Deletions-to-Make-String-Balanced.md" >}})Medium58.9%
1673Find the Most Competitive Subsequence[Go]({{< relref "/ChapterFour/1600~1699/1673.Find-the-Most-Competitive-Subsequence.md" >}})Medium49.3%
1700Number of Students Unable to Eat Lunch[Go]({{< relref "/ChapterFour/1700~1799/1700.Number-of-Students-Unable-to-Eat-Lunch.md" >}})Easy68.7%
------------------------------------------------------------------------------------------------------------------------------------------------

<div style="display: flex;justify-content: space-between;align-items: center;"> <p><a href="https://books.halfrost.com/leetcode/ChapterTwo/Linked_List/">⬅️上一页</a></p> <p><a href="https://books.halfrost.com/leetcode/ChapterTwo/Tree/">下一页➡️</a></p> </div>