Stacks & Queues

Master stack and queue data structures with implementation and problem-solving techniques.

Showing 20 of 20 questions
Easy: 5
Medium: 11
Hard: 4
Question Difficulty
Implement Queue using Stacks
Implement a queue using two stacks with O(1) amortized time complexity for all operations.
Easy
Implement Queue
Implement a queue using arrays or linked lists with O(1) time complexity for all operations.
Easy
Implement Stack using Queues
Implement a stack using two queues with O(1) amortized time complexity for all operations.
Easy
Implement Stack
Design and implement a stack data structure with push, pop, top, and empty operations
Easy
Valid Parentheses
Determine if the input string has valid brackets that are properly opened and closed
Easy
Celebrity Problem
Find the celebrity in a party of n people using the minimum number of questions.
Medium
Daily Temperatures
Find the number of days until a warmer temperature for each day.
Medium
Decode String
Decode a string encoded with the format k[encoded_string].
Medium
Design Circular Queue
Design a circular queue with fixed size that supports enqueue, dequeue, front, rear, isEmpty, and isFull operations.
Medium
Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Medium
Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time
Medium
Minimum Insertions to Balance Parentheses
Find minimum insertions needed to balance parentheses string
Medium
Next Greater Element
Find the next greater element for each element in an array.
Medium
Remove K Digits
Remove k digits from a number to make it as small as possible
Medium
Rotten Oranges Problem
Find the minimum time for all oranges to rot using BFS
Medium
Stock Span Problem
Calculate the span of stock prices for each day
Medium
Expression Evaluation
Evaluate mathematical expressions with proper operator precedence and parentheses.
Hard
Largest Rectangle in Histogram
Find the largest rectangle that can be formed in a histogram
Hard
Max Stack
Design a stack that supports push, pop, top, peekMax, and popMax operations
Hard
Sliding Window Maximum
Find the maximum element in each sliding window of size k.
Hard