Stack Study Guide ================= :::warning [< Return to Home Page](https://hackmd.io/@siansiansu/HknJJm0W0) ::: Basic Stack Operations ---------------------- Fundamental problems that introduce the concept and basic usage of stacks. ### Practice Problems - 🟨 [71\. Simplify Path](https://leetcode.com/problems/simplify-path/) \[[Solution](https://hackmd.io/@siansiansu/HJ2ZwP1BA)\] - 🟨 [394\. Decode String](https://leetcode.com/problems/decode-string/) - 🟨 [735\. Asteroid Collision](https://leetcode.com/problems/asteroid-collision/) - 🟥 [895\. Maximum Frequency Stack](https://leetcode.com/problems/maximum-frequency-stack/) Mathematical Operations and Expression Evaluation ------------------------------------------------- Problems involving arithmetic operations and evaluating mathematical expressions using stacks. ### Practice Problems - 🟨 [150\. Evaluate Reverse Polish Notation](https://leetcode.com/problems/evaluate-reverse-polish-notation/) \[[Solution](https://hackmd.io/@siansiansu/S1Z6hBJS0)\] - 🟥 [224\. Basic Calculator](https://leetcode.com/problems/basic-calculator/) \[[Solution](https://hackmd.io/@siansiansu/SJobq3rQ0)\] - 🟨 [227\. Basic Calculator II](https://leetcode.com/problems/basic-calculator-ii/) Parentheses Matching and Processing ----------------------------------- Problems that involve validating and manipulating strings with parentheses using stacks. ### Practice Problems - 🟩 [20\. Valid Parentheses](https://leetcode.com/problems/valid-parentheses/) \[[Solution](https://hackmd.io/@siansiansu/By55cMwfR)\] - 🟥 [32\. Longest Valid Parentheses](https://leetcode.com/problems/longest-valid-parentheses/) - 🟨 [1190\. Reverse Substrings Between Each Pair of Parentheses](https://leetcode.com/problems/reverse-substrings-between-each-pair-of-parentheses/) \[[Solution](https://hackmd.io/@siansiansu/ByqjD32DR)\] Two Stacks ---------- Problems that require the use of two stacks to solve efficiently. ### Practice Problems - 🟨 [155\. Min Stack](https://leetcode.com/problems/min-stack/) \[[Solution](https://hackmd.io/@siansiansu/rJRNHrjM0)\] - 🟩 [232\. Implement Queue using Stacks](https://leetcode.com/problems/implement-queue-using-stacks/) \[[Solution](https://hackmd.io/@siansiansu/BJJpYvwfA)\] Monotonic Stack --------------- Problems involving monotonic stacks, where elements are always sorted. ### Practice Problems - 🟩 [496\. Next Greater Element I](https://leetcode.com/problems/next-greater-element-i/) - 🟨 [503\. Next Greater Element II](https://leetcode.com/problems/next-greater-element-ii/) - 🟨 [739\. Daily Temperatures](https://leetcode.com/problems/daily-temperatures/) \[[Solution](https://hackmd.io/@siansiansu/rkMQf3SmC)\] ### Histogram and Interval Problems A subset of monotonic stack problems dealing with histograms and intervals. Practice Problems ----------------- - 🟥 [84\. Largest Rectangle in Histogram](https://leetcode.com/problems/largest-rectangle-in-histogram/) \[[Solution](https://hackmd.io/@siansiansu/BJ9-PmBX0)\] - 🟥 [2334\. Subarray With Elements Greater Than Varying Threshold](https://leetcode.com/problems/subarray-with-elements-greater-than-varying-threshold/) \[[Solution](https://hackmd.io/@siansiansu/BkPdjCbBC)\] Problem Difficulty Legend ------------------------- - 🟩 Easy - 🟨 Medium - 🟧 Medium-Hard - 🟥 Hard - ⬛ Very Hard Additional Resources -------------------- - [Stack Data Structure (Video)](https://www.youtube.com/watch?v=wjI1WNcIntg) - [Monotonic Stack Explained](https://labuladong.gitbook.io/algo-en/ii.-data-structure/monotonicstack) - [Stack Applications in Computer Science](https://www.geeksforgeeks.org/stack-data-structure-introduction-program/)