Stack Problems
140 Stack LeetCode problems · Solve with AI-powered hints & step-by-step explanations.
Learn the coding interview patterns behind these problems.
Start with these
All Stack problems
20 Valid Parentheses Easy32 Longest Valid Parentheses Hard42 Trapping Rain Water Hard71 Simplify Path Medium84 Largest Rectangle in Histogram Hard85 Maximal Rectangle Hard94 Binary Tree Inorder Traversal Easy114 Flatten Binary Tree to Linked List Medium143 Reorder List Medium144 Binary Tree Preorder Traversal Easy145 Binary Tree Postorder Traversal Easy150 Evaluate Reverse Polish Notation Medium155 Min Stack Medium173 Binary Search Tree Iterator Medium224 Basic Calculator Hard225 Implement Stack using Queues Easy227 Basic Calculator II Medium232 Implement Queue using Stacks Easy234 Palindrome Linked List Easy316 Remove Duplicate Letters Medium321 Create Maximum Number Hard331 Verify Preorder Serialization of a Binary Tree Medium341 Flatten Nested List Iterator Medium385 Mini Parser Medium388 Longest Absolute File Path Medium394 Decode String Medium402 Remove K Digits Medium445 Add Two Numbers II Medium456 132 Pattern Medium488 Zuma Game Hard496 Next Greater Element I Easy503 Next Greater Element II Medium581 Shortest Unsorted Continuous Subarray Medium589 N-ary Tree Preorder Traversal Easy590 N-ary Tree Postorder Traversal Easy591 Tag Validator Hard636 Exclusive Time of Functions Medium654 Maximum Binary Tree Medium678 Valid Parenthesis String Medium682 Baseball Game Easy726 Number of Atoms Hard735 Asteroid Collision Medium736 Parse Lisp Expression Hard739 Daily Temperatures Medium768 Max Chunks To Make Sorted II Hard769 Max Chunks To Make Sorted Medium770 Basic Calculator IV Hard844 Backspace String Compare Easy853 Car Fleet Medium856 Score of Parentheses Medium880 Decoded String at Index Medium895 Maximum Frequency Stack Hard897 Increasing Order Search Tree Easy901 Online Stock Span Medium907 Sum of Subarray Minimums Medium921 Minimum Add to Make Parentheses Valid Medium936 Stamping The Sequence Hard946 Validate Stack Sequences Medium962 Maximum Width Ramp Medium975 Odd Even Jump Hard1003 Check If Word Is Valid After Substitutions Medium1006 Clumsy Factorial Medium1008 Construct Binary Search Tree from Preorder Traversal Medium1019 Next Greater Node In Linked List Medium1021 Remove Outermost Parentheses Easy1047 Remove All Adjacent Duplicates In String Easy1081 Smallest Subsequence of Distinct Characters Medium1096 Brace Expansion II Hard1106 Parsing A Boolean Expression Hard1111 Maximum Nesting Depth of Two Valid Parentheses Strings Medium1124 Longest Well-Performing Interval Medium1130 Minimum Cost Tree From Leaf Values Medium1172 Dinner Plate Stacks Hard1190 Reverse Substrings Between Each Pair of Parentheses Medium1209 Remove All Adjacent Duplicates in String II Medium1249 Minimum Remove to Make Valid Parentheses Medium1381 Design a Stack With Increment Operation Medium1441 Build an Array With Stack Operations Medium1472 Design Browser History Medium1475 Final Prices With a Special Discount in a Shop Easy1504 Count Submatrices With All Ones Medium1526 Minimum Number of Increments on Subarrays to Form a Target Array Hard1541 Minimum Insertions to Balance a Parentheses String Medium1544 Make The String Great Easy1574 Shortest Subarray to be Removed to Make Array Sorted Medium1598 Crawler Log Folder Easy1614 Maximum Nesting Depth of the Parentheses Easy1653 Minimum Deletions to Make String Balanced Medium1673 Find the Most Competitive Subsequence Medium1700 Number of Students Unable to Eat Lunch Easy1717 Maximum Score From Removing Substrings Medium1776 Car Fleet II Hard1793 Maximum Score of a Good Subarray Hard1856 Maximum Subarray Min-Product Medium1896 Minimum Cost to Change the Final Value of Expression Hard1910 Remove All Occurrences of a Substring Medium1944 Number of Visible People in a Queue Hard1963 Minimum Number of Swaps to Make the String Balanced Medium1996 The Number of Weak Characters in the Game Medium2000 Reverse Prefix of Word Easy2019 The Score of Students Solving Math Expression Hard2030 Smallest K-Length Subsequence With Occurrences of a Letter Hard2104 Sum of Subarray Ranges Medium2116 Check if a Parentheses String Can Be Valid Medium2130 Maximum Twin Sum of a Linked List Medium2197 Replace Non-Coprime Numbers in Array Hard2211 Count Collisions on a Road Medium2216 Minimum Deletions to Make Array Beautiful Medium2281 Sum of Total Strength of Wizards Hard2289 Steps to Make Array Non-decreasing Medium2296 Design a Text Editor Hard2334 Subarray With Elements Greater Than Varying Threshold Hard2375 Construct Smallest Number From DI String Medium2390 Removing Stars From a String Medium2434 Using a Robot to Print the Lexicographically Smallest String Medium2454 Next Greater Element IV Hard2487 Remove Nodes From Linked List Medium2589 Minimum Time to Complete All Tasks Hard2617 Minimum Number of Visited Cells in a Grid Hard2645 Minimum Additions to Make Valid String Medium2696 Minimum String Length After Removing Substrings Easy2736 Maximum Sum Queries Hard2751 Robot Collisions Hard2813 Maximum Elegance of a K-Length Subsequence Hard2816 Double a Number Represented as a Linked List Medium2818 Apply Operations to Maximize Score Hard2865 Beautiful Towers I Medium2866 Beautiful Towers II Medium2940 Find Building Where Alice and Bob Can Meet Hard2945 Find Maximum Non-decreasing Array Length Hard3113 Find the Number of Subarrays Where Boundary Elements Are Maximum Hard3170 Lexicographically Minimum String After Removing Stars Medium3174 Clear Digits Easy3229 Minimum Operations to Make Array Equal to Target Hard3412 Find Mirror Score of a String Medium3420 Count Non-Decreasing Subarrays After K Operations Hard3430 Maximum and Minimum Sums of at Most Size K Subarrays Hard3523 Make Array Non-decreasing Medium3542 Minimum Operations to Convert All Elements to Zero Medium3561 Resulting String After Adjacent Removals Medium