LeetCodechevron_rightCategorieschevron_rightstack
layers

stack

140 problems
Easy: 23Medium: 75Hard: 42

stack is one of the most repeated interview dimensions. Start with edge-safe fundamentals, then move into pattern-level trade-offs.

Interview Signal

Frequently tests problem modeling, edge handling, and verbal clarity.

Common Pitfall

Template-only answers break under follow-up questioning.

Practice Strategy

Practice in 3-5 problem rounds and always review complexity alternatives.

Recommended Progression

Problem bank

stack problem bank

Start with a compact scan-friendly list and progressively load more so the topic page stays readable even when the corpus is large.

Progressive topic library

Built for large topic sets: scan the structure first, then go deeper.

hourglass_bottomScroll to continue
search
tuneDifficulty

Showing 24 / 140 problems

+24 per load
#TitleDifficulty
20

Valid Parentheses

Determine if a string of parentheses, brackets, and braces is correctly nested using a stack for proper order validation…

Easy
32

Longest Valid Parentheses

Compute the length of the longest well-formed parentheses substring using state transition dynamic programming and stack…

Hard
42

Trapping Rain Water

Calculate the total trapped rain water using the elevation map array, leveraging dynamic programming and two-pointer pat…

Hard
71

Simplify Path

Simplify a Unix-style path by transforming it into its canonical form using stack-based state management.

Medium
84

Largest Rectangle in Histogram

Find the maximal rectangular area in a histogram using stack-based state management for precise bar tracking and width c…

Hard
85

Maximal Rectangle

Compute the largest rectangle of 1's in a binary matrix using dynamic programming and stack-based state transitions effi…

Hard
94

Binary Tree Inorder Traversal

Binary Tree Inorder Traversal asks you to visit left subtree, node, then right subtree without losing position while mov…

Easy
114

Flatten Binary Tree to Linked List

Flatten a binary tree into a right-skewed linked list by manipulating pointers following a pre-order traversal, handling…

Medium
143

Reorder List

Reorder List requires careful pointer manipulation in a singly linked list to interleave nodes from the ends without alt…

Medium
144

Binary Tree Preorder Traversal

Perform a binary tree preorder traversal by visiting root nodes first, then left and right subtrees, tracking state iter…

Easy
145

Binary Tree Postorder Traversal

Solve Binary Tree Postorder Traversal using state tracking and binary-tree traversal techniques, focusing on Stack, Tree…

Easy
150

Evaluate Reverse Polish Notation

Compute the result of an arithmetic expression in Reverse Polish Notation using a stack to manage operands efficiently.

Medium
155

Min Stack

Design a stack with O(1) operations to push, pop, retrieve the top element, and get the minimum element in constant time…

Medium
173

Binary Search Tree Iterator

Implement an iterator for in-order traversal of a binary search tree (BST), maintaining traversal state with stack-based…

Medium
224

Basic Calculator

Implement a basic calculator to evaluate mathematical expressions, ensuring correct evaluation with stack-based manageme…

Hard
225

Implement Stack using Queues

This problem tests your ability to simulate a LIFO stack using two queues while preserving all standard stack operations…

Easy
227

Basic Calculator II

Basic Calculator II evaluates a mathematical expression with operators and integers, handling basic arithmetic with prec…

Medium
232

Implement Queue using Stacks

Implement a queue using two stacks, focusing on stack-based state management to achieve FIFO behavior in a queue.

Easy
234

Palindrome Linked List

Solve Palindrome Linked List by finding the midpoint, reversing the second half, and comparing mirrored nodes in linear …

Easy
316

Remove Duplicate Letters

Remove duplicate letters from a string to produce the lexicographically smallest result using stack-based state manageme…

Medium
321

Create Maximum Number

Create Maximum Number involves merging digits from two arrays while preserving order, maximizing the resulting number.

Hard
331

Verify Preorder Serialization of a Binary Tree

Determine if a given string correctly represents a binary tree preorder traversal using state tracking and slot counting…

Medium
341

Flatten Nested List Iterator

Implement an iterator to flatten a nested list of integers, accounting for potential nesting levels.

Medium
385

Mini Parser

Deserialize a nested list string using stack-based state management, handling integers and nested lists with depth-first…

Medium

swap_vertScroll inside the bank to auto-load more

Related Patterns

Stack LeetCode Problems: 140 Solutions