Skip to main content

25 Stack, Queue, LinkedList Problems To Revise Before Interviews

ยท 5 min read

I've curated 25 Stack, Queue, LinkedList problems that teach you all major patterns. These aren't random problems, they're specifically chosen to build your intuition for technical interviews.


๐ŸŽฏ The Essential Problemsโ€‹

Stack Problemsโ€‹

1. Valid Parentheses - LeetCode 20

  • Pattern: Basic stack for matching
  • Why: Foundation for all parsing problems
  • Companies: Amazon, Microsoft, Meta, Bloomberg, Apple

2. Min Stack - LeetCode 155

  • Pattern: Auxiliary stack for O(1) operations
  • Why: Tests understanding of trade-offs (space vs time)
  • Companies: Amazon, Bloomberg, Microsoft

3. Implement Queue using Stacks - LeetCode 232

  • Pattern: Two stacks technique
  • Why: Tests understanding of both data structures
  • Companies: Microsoft, Bloomberg, Amazon

4. Daily Temperatures - LeetCode 739

  • Pattern: Monotonic stack
  • Why: Most important stack pattern for interviews
  • Companies: Amazon, Google, Meta, Bloomberg

5. Largest Rectangle in Histogram - LeetCode 84

  • Pattern: Monotonic stack for area calculation
  • Why: Hard problem that becomes medium with stack
  • Companies: Amazon, Google, Meta, Microsoft

6. Basic Calculator II - LeetCode 227

  • Pattern: Stack for expression evaluation
  • Why: Shows real-world stack application
  • Companies: Meta, Amazon, Google

Queue Problemsโ€‹

7. Implement Stack using Queues - LeetCode 225

  • Pattern: Queue rotation technique
  • Why: Tests queue manipulation understanding
  • Companies: Bloomberg, Microsoft

8. Design Circular Queue - LeetCode 622

  • Pattern: Array-based queue with wraparound
  • Why: Tests boundary handling and modular arithmetic
  • Companies: Amazon, Microsoft, Meta

9. Moving Average from Data Stream - LeetCode 346

  • Pattern: Queue for sliding window
  • Why: Shows queue in streaming context
  • Companies: Amazon, Google, Meta

Linked List Problemsโ€‹

10. Reverse Linked List - LeetCode 206

  • Pattern: Iterative and recursive reversal
  • Why: Most important linked list operation
  • Companies: Everyone

11. Merge Two Sorted Lists - LeetCode 21

  • Pattern: Two pointer merge
  • Why: Foundation for merge sort, merge operations
  • Companies: Amazon, Microsoft, Meta, Apple

12. Remove Nth Node From End of List - LeetCode 19

  • Pattern: Two pointer (fast/slow)
  • Why: Classic two-pointer technique
  • Companies: Amazon, Meta, Bloomberg

13. Linked List Cycle - LeetCode 141

  • Pattern: Floyd's cycle detection (fast/slow pointers)
  • Why: Fundamental algorithm, shows up in many forms
  • Companies: Amazon, Microsoft, Meta, Apple

14. Linked List Cycle II - LeetCode 142

  • Pattern: Finding cycle start with math
  • Why: Advanced pointer manipulation
  • Companies: Amazon, Microsoft, Meta

15. Intersection of Two Linked Lists - LeetCode 160

  • Pattern: Length difference or two-pointer technique
  • Why: Tests pointer manipulation cleverness
  • Companies: Amazon, Microsoft, Bloomberg

16. Palindrome Linked List - LeetCode 234

  • Pattern: Find middle + reverse + compare
  • Why: Combines multiple linked list patterns
  • Companies: Amazon, Meta, Microsoft

17. Remove Duplicates from Sorted List - LeetCode 83

  • Pattern: Single pass deletion
  • Why: Basic pointer manipulation
  • Companies: Amazon, Microsoft

Advanced Problemsโ€‹

18. LRU Cache - LeetCode 146

  • Pattern: Hash map + doubly linked list
  • Why: System design favorite, tests multiple skills
  • Companies: Amazon, Meta, Microsoft, Google, Apple

19. Add Two Numbers - LeetCode 2

  • Pattern: Linked list arithmetic with carry
  • Why: Tests edge case handling
  • Companies: Amazon, Microsoft, Meta, Bloomberg

20. Reverse Nodes in k-Group - LeetCode 25

  • Pattern: Segmented reversal
  • Why: Hard problem, builds on reverse linked list
  • Companies: Meta, Amazon, Microsoft

21. Copy List with Random Pointer - LeetCode 138

  • Pattern: HashMap or interweaving technique
  • Why: Tests deep copy understanding
  • Companies: Amazon, Microsoft, Meta

22. Sort List - LeetCode 148

  • Pattern: Merge sort on linked list
  • Why: Combines sorting with linked list operations
  • Companies: Amazon, Meta, Microsoft

23. Reorder List - LeetCode 143

  • Pattern: Find middle + reverse + merge
  • Why: Combines three core operations
  • Companies: Amazon, Meta, Microsoft

24. Flatten a Multilevel Doubly Linked List - LeetCode 430

  • Pattern: Stack or recursion for nested structures
  • Why: Tests handling of complex pointer structures
  • Companies: Amazon, Microsoft

25. Design Browser History - LeetCode 1472

  • Pattern: Doubly linked list or array
  • Why: Real-world application of linked list
  • Companies: Amazon, Google

๐Ÿ“š Study Strategyโ€‹

Week 1-2: Master basic operations (problems 1-9, 10-12) Week 3-4: Two-pointer techniques and cycle detection (problems 13-17) Week 5-6: Advanced patterns and combinations (problems 18-25)

Practice these problems multiple times until you can code them without looking at solutions. Understanding the patterns is more important than memorizing solutions.