A Stack is a linear data structure in which the insertion of a new element and removal of an existing element takes place at the same end, represented as the top of the stack. To learn about Stack Data Structure in detail, please refer to the Tutorial on Stack Data Structure.
Easy Problems
- Parenthesis Checker
- Reverse a String using Stack
- Postfix to Prefix
- Two stacks in an array
- Delete Middle element from stack
- Reverse individual words
Medium Problems
- Queue using Stacks
- Stack using Queues
- Stack using single queue
- Evaluate Postfix Expression
- Next Greater Element
- Nearest Smaller Element
- Next Smaller of next Greater
- Sort a stack using a temporary stack
- Stock Span Problem
- Reverse a Stack using recursion
- Infix to Postfix
- Delete consecutive same words
- A Stack with getMin() in O(1) Time
- Count of Subarrays with first as minimum
- Length of the longest valid substring
- Index of closing bracket
- Next Greater Frequency Element
- Max Diff between nearest smallers
- Max product of indexes of next greater
- The Celebrity Problem
Hard Problems
- Valid stack permutation
- Stack with getMin() in O(1)
- Stack with getRandom() in O(1)
- Equivalent expressions
- k stacks in a single array
- Largest rectangular area in a histogram
- Clone a Stack without Extra Space
- Custom Browser History
- Maximum Rectangle with all 1s
- Sort a stack using Recursion
- Stack with findMiddle() and deleteMiddle()
- Maximum visible people
- Count distinct Max Differences in Subarrays
- Longest Correct Bracket Subsequence Set
- Maximum of minimum for every window size