Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

150 Curated DSA Problems — ML Engineer Interview Prep

Ordered by priority (top patterns = most frequently tested for ML/data roles). All problem IDs are LeetCode numbers. Do in Python.


1. Arrays & Hashing (Highest priority — ~20 problems)

  1. LC 1 — Two Sum
  2. LC 217 — Contains Duplicate
  3. LC 242 — Valid Anagram
  4. LC 49 — Group Anagrams
  5. LC 347 — Top K Frequent Elements
  6. LC 238 — Product of Array Except Self
  7. LC 128 — Longest Consecutive Sequence
  8. LC 271 — Encode and Decode Strings
  9. LC 36 — Valid Sudoku
  10. LC 454 — 4Sum II
  11. LC 383 — Ransom Note
  12. LC 1512 — Number of Good Pairs
  13. LC 692 — Top K Frequent Words
  14. LC 895 — Maximum Frequency Stack
  15. LC 41 — First Missing Positive
  16. LC 560 — Subarray Sum Equals K
  17. LC 953 — Verifying an Alien Dictionary
  18. LC 496 — Next Greater Element I
  19. LC 1502 — Can Make Arithmetic Progression
  20. LC 1010 — Pairs of Songs With Total Durations Divisible by 60

2. Two Pointers (~10 problems)

  1. LC 125 — Valid Palindrome
  2. LC 167 — Two Sum II (sorted array)
  3. LC 15 — 3Sum
  4. LC 11 — Container With Most Water
  5. LC 42 — Trapping Rain Water
  6. LC 283 — Move Zeroes
  7. LC 26 — Remove Duplicates from Sorted Array
  8. LC 344 — Reverse String
  9. LC 977 — Squares of a Sorted Array
  10. LC 88 — Merge Sorted Array

3. Sliding Window (~12 problems)

  1. LC 121 — Best Time to Buy and Sell Stock
  2. LC 3 — Longest Substring Without Repeating Characters
  3. LC 424 — Longest Repeating Character Replacement
  4. LC 567 — Permutation in String
  5. LC 76 — Minimum Window Substring
  6. LC 239 — Sliding Window Maximum
  7. LC 209 — Minimum Size Subarray Sum
  8. LC 643 — Maximum Average Subarray I
  9. LC 1004 — Max Consecutive Ones III
  10. LC 1493 — Longest Subarray of 1's After Deleting One Element
  11. LC 30 — Substring with Concatenation of All Words
  12. LC 992 — Subarrays with K Different Integers

4. Stack (~8 problems)

  1. LC 20 — Valid Parentheses
  2. LC 155 — Min Stack
  3. LC 150 — Evaluate Reverse Polish Notation
  4. LC 22 — Generate Parentheses
  5. LC 739 — Daily Temperatures
  6. LC 853 — Car Fleet
  7. LC 84 — Largest Rectangle in Histogram
  8. LC 71 — Simplify Path

5. Binary Search (~8 problems)

  1. LC 704 — Binary Search
  2. LC 74 — Search a 2D Matrix
  3. LC 875 — Koko Eating Bananas
  4. LC 153 — Find Minimum in Rotated Sorted Array
  5. LC 33 — Search in Rotated Sorted Array
  6. LC 981 — Time Based Key-Value Store
  7. LC 4 — Median of Two Sorted Arrays
  8. LC 162 — Find Peak Element

6. Linked List (~10 problems)

  1. LC 206 — Reverse Linked List
  2. LC 21 — Merge Two Sorted Lists
  3. LC 143 — Reorder List
  4. LC 19 — Remove Nth Node From End of List
  5. LC 138 — Copy List with Random Pointer
  6. LC 2 — Add Two Numbers
  7. LC 141 — Linked List Cycle
  8. LC 287 — Find the Duplicate Number
  9. LC 146 — LRU Cache
  10. LC 23 — Merge k Sorted Lists

7. Trees (High priority for interviews — ~18 problems)

  1. LC 104 — Maximum Depth of Binary Tree
  2. LC 226 — Invert Binary Tree
  3. LC 100 — Same Tree
  4. LC 572 — Subtree of Another Tree
  5. LC 235 — Lowest Common Ancestor of a BST
  6. LC 102 — Binary Tree Level Order Traversal
  7. LC 199 — Binary Tree Right Side View
  8. LC 1448 — Count Good Nodes in Binary Tree
  9. LC 98 — Validate Binary Search Tree
  10. LC 230 — Kth Smallest Element in a BST
  11. LC 105 — Construct Binary Tree from Preorder and Inorder
  12. LC 124 — Binary Tree Maximum Path Sum
  13. LC 297 — Serialize and Deserialize Binary Tree
  14. LC 543 — Diameter of Binary Tree
  15. LC 110 — Balanced Binary Tree
  16. LC 108 — Convert Sorted Array to BST
  17. LC 617 — Merge Two Binary Trees
  18. LC 112 — Path Sum

8. Heap / Priority Queue (Very relevant — ~10 problems)

  1. LC 703 — Kth Largest Element in a Stream
  2. LC 1046 — Last Stone Weight
  3. LC 973 — K Closest Points to Origin
  4. LC 215 — Kth Largest Element in an Array
  5. LC 621 — Task Scheduler
  6. LC 355 — Design Twitter
  7. LC 295 — Find Median from Data Stream
  8. LC 767 — Reorganize String
  9. LC 1642 — Furthest Building You Can Reach
  10. LC 23 — Merge k Sorted Lists (revisit via heap)

9. Backtracking (~8 — light coverage, still asked occasionally)

  1. LC 78 — Subsets
  2. LC 39 — Combination Sum
  3. LC 46 — Permutations
  4. LC 90 — Subsets II
  5. LC 40 — Combination Sum II
  6. LC 79 — Word Search
  7. LC 131 — Palindrome Partitioning
  8. LC 17 — Letter Combinations of a Phone Number

10. Graphs — BFS/DFS only (Enough for ML roles — ~14 problems)

  1. LC 200 — Number of Islands
  2. LC 133 — Clone Graph
  3. LC 695 — Max Area of Island
  4. LC 417 — Pacific Atlantic Water Flow
  5. LC 130 — Surrounded Regions
  6. LC 994 — Rotting Oranges
  7. LC 286 — Walls and Gates
  8. LC 207 — Course Schedule
  9. LC 210 — Course Schedule II
  10. LC 684 — Redundant Connection
  11. LC 323 — Number of Connected Components
  12. LC 261 — Graph Valid Tree
  13. LC 127 — Word Ladder
  14. LC 743 — Network Delay Time

11. 1-D Dynamic Programming (High priority — ~15 problems)

  1. LC 70 — Climbing Stairs
  2. LC 746 — Min Cost Climbing Stairs
  3. LC 198 — House Robber
  4. LC 213 — House Robber II
  5. LC 5 — Longest Palindromic Substring
  6. LC 647 — Palindromic Substrings
  7. LC 91 — Decode Ways
  8. LC 322 — Coin Change
  9. LC 152 — Maximum Product Subarray
  10. LC 139 — Word Break
  11. LC 300 — Longest Increasing Subsequence
  12. LC 416 — Partition Equal Subset Sum
  13. LC 62 — Unique Paths
  14. LC 55 — Jump Game
  15. LC 1143 — Longest Common Subsequence

12. 2-D DP (~8 — moderate priority)

  1. LC 1143 — Longest Common Subsequence (already above; alt: 72 Edit Distance)
  2. LC 72 — Edit Distance
  3. LC 97 — Interleaving String
  4. LC 329 — Longest Increasing Path in a Matrix
  5. LC 115 — Distinct Subsequences
  6. LC 174 — Dungeon Game
  7. LC 64 — Minimum Path Sum
  8. LC 63 — Unique Paths II

13. Greedy (~6)

  1. LC 53 — Maximum Subarray
  2. LC 55 — Jump Game (revisit)
  3. LC 45 — Jump Game II
  4. LC 134 — Gas Station
  5. LC 763 — Partition Labels
  6. LC 435 — Non-overlapping Intervals

14. Intervals (Your known gap — cover fully, ~6)

  1. LC 57 — Insert Interval
  2. LC 56 — Merge Intervals
  3. LC 435 — Non-overlapping Intervals (revisit)
  4. LC 252 — Meeting Rooms
  5. LC 253 — Meeting Rooms II
  6. LC 1851 — Minimum Interval to Include Each Query

Deliberately excluded (CP-territory, low ROI for ML interviews)

  • Segment trees, Fenwick trees, tries (except if asked for autocomplete-style system design)
  • Heavy number theory (modular exponentiation, sieve variants, combinatorics beyond basics)
  • Advanced string algorithms (KMP, Z-function, suffix arrays)
  • Game theory / Nim-style problems
  • Bitmask DP, digit DP

Suggested pace

  • 5–6 problems/week alongside your ML/HOML work → ~150 problems in ~26–28 weeks
  • If compressing for October: 8–10/week → done in ~16 weeks, matching your existing DSA plan timeline
  • Always redo Two Sum, Merge Intervals, Kth Largest, and Course Schedule cold — these 4 patterns cover a disproportionate share of actual interview questions
  • Track weak patterns separately (yours: heaps, intervals) and over-index practice there

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors