Skip to content

LeetCode 150 (NeetCode)

Overview

The NeetCode 150 is the de facto curated problem set for modern tech interview prep, a superset of Blind 75 organized by pattern. This topic walks through each problem with three tiers of solution:

  1. Brute force, the most direct, often O(n²) or worse; always runs and always correct.
  2. Improved, a standard optimization: sorting, a single hash map, two pointers.
  3. Optimized, the interview-level answer: best time and space complexity the problem admits.

Each problem page includes the prompt, all three approaches with working Python, and a complexity summary table.

Categories

  1. Arrays & Hashing (9 problems)
  2. Two Pointers (5 problems)
  3. Sliding Window (6 problems)
  4. Stack (7 problems)
  5. Binary Search (7 problems)
  6. Linked List (11 problems)
  7. Trees (15 problems)
  8. Heap / Priority Queue (7 problems)
  9. Backtracking (9 problems)
  10. Tries (3 problems)
  11. Graphs (13 problems)
  12. Advanced Graphs (5 problems)
  13. 1-D Dynamic Programming (12 problems)
  14. 2-D Dynamic Programming (11 problems)
  15. Greedy (8 problems)
  16. Intervals (6 problems)
  17. Math & Geometry (8 problems)
  18. Bit Manipulation (7 problems)
  19. Matrix (4 problems)

Browse by difficulty

Pattern-grouping is the default; difficulty is the orthogonal axis when you want to ramp up gradually or save the hard set for last.

How to use

Work through a category end-to-end. Within each problem:

  • Read the prompt. Try to solve without scrolling.
  • If stuck, read only Approach 1 (brute force). Reimplement yourself.
  • Compare your solution with Approach 3. Understand why the gap closes, usually a hash map, a monotonic structure, or a clever invariant.

Complexity sections use standard Big-O notation. n is the input size unless otherwise noted.

References

  • Data structures, the longer-form reference for the structures referenced in every solution.