DEV Community

Code Notes
Code Notes

Posted on Edited on

The 150 DSA problems I'd actually do before a coding interview (Java & Python)

Most "interview prep" lists are 500 problems long. Nobody finishes them. Interviewers at most companies test the same ~15 patterns again and again, so a short list that covers every pattern beats a long list that covers the same one ten times.

Here's how I'd group a 150-problem plan:

  1. Arrays & hashing (20) — two-sum style lookups, counting, prefix sums.
  2. Two pointers & sliding window (20) — sorted arrays, longest/shortest substring problems.
  3. Stacks & queues (10) — valid brackets, next greater element, monotonic stack.
  4. Binary search (10) — not just "find x": search on the answer.
  5. Linked lists (10) — reverse, merge, cycle detection.
  6. Trees (20) — DFS/BFS, BST checks, lowest common ancestor.
  7. Heaps (8) — top-k, merge k lists, running median.
  8. Graphs (15) — BFS shortest path, islands, topological sort, union-find.
  9. Backtracking (10) — subsets, permutations, N-Queens.
  10. Dynamic programming (22) — 1D (climbing stairs, house robber), 2D (grid paths, LCS), knapsack.
  11. Greedy & intervals (5) — merge intervals, meeting rooms.

How to work through it:

  • Do one pattern at a time. Don't shuffle.
  • Give each problem 25 minutes. Stuck? Read the idea, close it, write the code yourself.
  • Re-solve anything you needed help with 3 days later.

I keep the full list, with a lesson for every pattern and an online judge to submit solutions, here (free):

Top comments (0)