Stack | LeetCode Problems

96 Stack solutions to LeetCode solutions.

Stack Problems View all solutions →

Valid Parentheses

#20 Easy

Longest Valid Parentheses

#32 Hard

Trapping Rain Water

#42 Hard

Simplify Path

#71 Medium

Largest Rectangle in Histogram

#84 Hard

Maximal Rectangle

#85 Hard

Binary Tree Inorder Traversal

#94 Easy

Flatten Binary Tree to Linked List

#114 Medium

Reorder List

#143 Medium

Binary Tree Preorder Traversal

#144 Easy

Binary Tree Postorder Traversal

#145 Easy

Evaluate Reverse Polish Notation

#150 Medium

Min Stack

#155 Medium

Binary Search Tree Iterator

#173 Medium

Basic Calculator

#224 Hard

Implement Stack using Queues

#225 Easy

Basic Calculator II

#227 Medium

Implement Queue using Stacks

#232 Easy

Palindrome Linked List

#234 Easy

Remove Duplicate Letters

#316 Medium

Create Maximum Number

#321 Hard

Verify Preorder Serialization of a Binary Tree

#331 Medium

Flatten Nested List Iterator

#341 Medium

Mini Parser

#385 Medium

Longest Absolute File Path

#388 Medium

Decode String

#394 Medium

Remove K Digits

#402 Medium

Add Two Numbers II

#445 Medium

132 Pattern

#456 Medium

Zuma Game

#488 Hard

Next Greater Element I

#496 Easy

Next Greater Element II

#503 Medium

Shortest Unsorted Continuous Subarray

#581 Medium

N-ary Tree Preorder Traversal

#589 Easy

N-ary Tree Postorder Traversal

#590 Easy

Tag Validator

#591 Hard

Exclusive Time of Functions

#636 Medium

Maximum Binary Tree

#654 Medium

Valid Parenthesis String

#678 Medium

Baseball Game

#682 Easy

Number of Atoms

#726 Hard

Asteroid Collision

#735 Medium

Parse Lisp Expression

#736 Hard

Daily Temperatures

#739 Medium

Max Chunks To Make Sorted II

#768 Hard

Max Chunks To Make Sorted

#769 Medium

Basic Calculator IV

#770 Hard

Backspace String Compare

#844 Easy

Car Fleet

#853 Medium

Score of Parentheses

#856 Medium

Decoded String at Index

#880 Medium

Maximum Frequency Stack

#895 Hard

Increasing Order Search Tree

#897 Easy

Online Stock Span

#901 Medium

Sum of Subarray Minimums

#907 Medium

Minimum Add to Make Parentheses Valid

#921 Medium

Stamping The Sequence

#936 Hard

Validate Stack Sequences

#946 Medium

Maximum Width Ramp

#962 Medium

Odd Even Jump

#975 Hard

Check If Word Is Valid After Substitutions

#1003 Medium

Clumsy Factorial

#1006 Medium

Construct Binary Search Tree from Preorder Traversal

#1008 Medium

Next Greater Node In Linked List

#1019 Medium

Remove Outermost Parentheses

#1021 Easy

Remove All Adjacent Duplicates In String

#1047 Easy

Smallest Subsequence of Distinct Characters

#1081 Medium

Brace Expansion II

#1096 Hard

Parsing A Boolean Expression

#1106 Hard

Maximum Nesting Depth of Two Valid Parentheses Strings

#1111 Medium

Longest Well-Performing Interval

#1124 Medium

Minimum Cost Tree From Leaf Values

#1130 Medium

Dinner Plate Stacks

#1172 Hard

Reverse Substrings Between Each Pair of Parentheses

#1190 Medium

Remove All Adjacent Duplicates in String II

#1209 Medium

Minimum Remove to Make Valid Parentheses

#1249 Medium

Design a Stack With Increment Operation

#1381 Medium

Build an Array With Stack Operations

#1441 Medium

Design Browser History

#1472 Medium

Final Prices With a Special Discount in a Shop

#1475 Easy

Count Submatrices With All Ones

#1504 Medium

Minimum Number of Increments on Subarrays to Form a Target Array

#1526 Hard

Minimum Insertions to Balance a Parentheses String

#1541 Medium

Make The String Great

#1544 Easy

Shortest Subarray to be Removed to Make Array Sorted

#1574 Medium

Crawler Log Folder

#1598 Easy

Maximum Nesting Depth of the Parentheses

#1614 Easy

Remove All Occurrences of a Substring

#1910 Medium

The Number of Weak Characters in the Game

#1996 Medium

Reverse Prefix of Word

#2000 Easy

Check if a Parentheses String Can Be Valid

#2116 Medium

Maximum Twin Sum of a Linked List

#2130 Medium

Construct Smallest Number From DI String

#2375 Medium

Removing Stars From a String

#2390 Medium

Apply Operations to Maximize Score

#2818 Hard

Clear Digits

#3174 Easy