Showing 20 of 20 questions
Easy: 0
Medium: 0
Hard: 0
Overview
Stacks and queues are essential data structures that follow LIFO (Last In First Out) and FIFO (First In First Out) principles. This section covers their implementation and common use cases.
Key Concepts
- Stack operations (push, pop, peek)
- Queue operations (enqueue, dequeue)
- Monotonic stack/queue
- Deque (double-ended queue)
- Priority queues
- Implementation using arrays and linked lists
Common Problems
Easy
- Valid Parentheses
- Implement Stack using Queues
- Implement Queue using Stacks
- Min Stack
Medium
- Daily Temperatures
- Next Greater Element
- Sliding Window Maximum
- Decode String
Hard
- Largest Rectangle in Histogram
- Trapping Rain Water (using stacks)
- Basic Calculator
Practice Tips
- Recognize patterns: Matching, monotonic sequences
- Auxiliary structures: Use stacks/queues to track state
- Time complexity: Most operations should be O(1) or O(n)
- Space trade-offs: Consider using extra space for optimization