AlgorithmStack

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)
支付宝扫码打赏 微信打赏

若你觉得我的文章对你有帮助,欢迎点击上方按钮对我打赏

扫描二维码,分享此文章

一缕殇流化隐半边冰霜's Picture
一缕殇流化隐半边冰霜

我是于德志 (@halfrost),一名来自中国的 iOS 开发者,已退役 acmer 。现居上海。从 2016 年开始写博客记录自己技术成长的一点一滴,到年底,成为简书推荐作者,2016 年度掘金最优秀的 10 佳原创作者。吾笃信:天道酬勤,勤能补拙。地道酬实,实能不弱。人道酬德,德能补寡。 目前就职于 饿了么 。

Shanghai「上海」 https://halfrost.com

Subscribe to Halfrost's Field | 冰霜之地

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!

Comments