30 Curated Coding Challenges (Beginner → Advanced)

0/7 in this phase0/57 across the roadmap

📖 Concept

These 30 carefully selected problems cover ALL major patterns and form a comprehensive practice set. Solve them in order — each builds on previous concepts.

Beginner (1-10): Foundation Patterns

  1. Two Sum — Hash Map (LeetCode 1)
  2. Valid Parentheses — Stack (LeetCode 20)
  3. Merge Two Sorted Lists — Linked List (LeetCode 21)
  4. Best Time to Buy and Sell Stock — Greedy (LeetCode 121)
  5. Valid Palindrome — Two Pointers (LeetCode 125)
  6. Maximum Subarray — DP/Kadane's (LeetCode 53)
  7. Binary Search — Foundation (LeetCode 704)
  8. Invert Binary Tree — Tree DFS (LeetCode 226)
  9. Climbing Stairs — DP (LeetCode 70)
  10. Contains Duplicate — Hash Set (LeetCode 217)

Intermediate (11-20): Core Patterns 11. Product of Array Except Self — Prefix (LeetCode 238) 12. 3Sum — Two Pointers (LeetCode 15) 13. Longest Substring Without Repeating — Sliding Window (LeetCode 3) 14. Group Anagrams — Hash Map (LeetCode 49) 15. Coin Change — DP (LeetCode 322) 16. Number of Islands — Graph DFS (LeetCode 200) 17. Validate BST — Tree DFS (LeetCode 98) 18. Course Schedule — Topological Sort (LeetCode 207) 19. LRU Cache — Design (LeetCode 146) 20. Implement Trie — Data Structure (LeetCode 208)

Advanced (21-30): Expert Patterns 21. Merge K Sorted Lists — Heap (LeetCode 23) 22. Longest Increasing Subsequence — DP (LeetCode 300) 23. Word Search II — Trie + Backtracking (LeetCode 212) 24. Sliding Window Maximum — Monotonic Deque (LeetCode 239) 25. Edit Distance — 2D DP (LeetCode 72) 26. Trapping Rain Water — Two Pointers/Stack (LeetCode 42) 27. Largest Rectangle in Histogram — Monotonic Stack (LeetCode 84) 28. Serialize/Deserialize Binary Tree — Design (LeetCode 297) 29. Median from Data Stream — Two Heaps (LeetCode 295) 30. Word Ladder — BFS (LeetCode 127)

How to use this list: Solve each problem with a 25/40/60 minute time limit (Easy/Medium/Hard). If stuck, read the editorial, understand the pattern, then re-solve without looking.

💻 Code Example

codeTap to expand ⛶
1// SOLUTIONS TO KEY CHALLENGES
2
3// #1 Two Sum — Hash Map O(n)
4function twoSum(nums, target) {
5 const map = new Map();
6 for (let i = 0; i < nums.length; i++) {
7 if (map.has(target - nums[i])) return [map.get(target - nums[i]), i];
8 map.set(nums[i], i);
9 }
10}
11
12// #6 Maximum Subarray — Kadane's O(n)
13function maxSubArray(nums) {
14 let max = nums[0], curr = nums[0];
15 for (let i = 1; i < nums.length; i++) {
16 curr = Math.max(nums[i], curr + nums[i]);
17 max = Math.max(max, curr);
18 }
19 return max;
20}
21
22// #13 Longest Substring Without Repeating — Sliding Window
23function lengthOfLongestSubstring(s) {
24 const map = new Map();
25 let max = 0, left = 0;
26 for (let right = 0; right < s.length; right++) {
27 if (map.has(s[right]) && map.get(s[right]) >= left)
28 left = map.get(s[right]) + 1;
29 map.set(s[right], right);
30 max = Math.max(max, right - left + 1);
31 }
32 return max;
33}
34
35// #15 Coin Change — DP O(amount × coins)
36function coinChange(coins, amount) {
37 const dp = new Array(amount + 1).fill(Infinity);
38 dp[0] = 0;
39 for (let i = 1; i <= amount; i++)
40 for (const c of coins)
41 if (c <= i) dp[i] = Math.min(dp[i], dp[i - c] + 1);
42 return dp[amount] === Infinity ? -1 : dp[amount];
43}
44
45// #16 Number of Islands — DFS
46function numIslands(grid) {
47 let count = 0;
48 for (let r = 0; r < grid.length; r++)
49 for (let c = 0; c < grid[0].length; c++)
50 if (grid[r][c] === '1') {
51 count++;
52 sink(grid, r, c);
53 }
54 return count;
55}
56function sink(g, r, c) {
57 if (r < 0 || r >= g.length || c < 0 || c >= g[0].length || g[r][c] !== '1') return;
58 g[r][c] = '0';
59 sink(g,r+1,c); sink(g,r-1,c); sink(g,r,c+1); sink(g,r,c-1);
60}
61
62// #26 Trapping Rain Water — Two Pointers O(n)
63function trap(height) {
64 let l = 0, r = height.length - 1, lMax = 0, rMax = 0, water = 0;
65 while (l < r) {
66 if (height[l] < height[r]) {
67 height[l] >= lMax ? lMax = height[l] : water += lMax - height[l];
68 l++;
69 } else {
70 height[r] >= rMax ? rMax = height[r] : water += rMax - height[r];
71 r--;
72 }
73 }
74 return water;
75}

🏋️ Practice Exercise

Your Mission (complete in 30 days): Week 1: Solve problems 1-10 (Easy, 25 min each) Week 2: Solve problems 11-17 (Medium, 40 min each) Week 3: Solve problems 18-25 (Medium-Hard, 40-60 min each) Week 4: Solve problems 26-30 (Hard, 60 min each) + review all

For each problem:

  1. Identify the pattern BEFORE coding
  2. Write pseudocode first
  3. Code the solution
  4. Test with 3 examples including edge cases
  5. Analyze time and space complexity
  6. If you needed hints, re-solve the next day without looking

⚠️ Common Mistakes

  • Solving in random order — this curated order builds concepts progressively

  • Spending 3+ hours on one problem — time-box and learn from the editorial

  • Not tracking which patterns are weak — keep a pattern strength log

  • Only coding solutions without explaining them — practice thinking out loud

  • Skipping easy problems — they build the foundation for harder patterns

💼 Interview Questions

🎤 Mock Interview

Practice a live interview for 30 Curated Coding Challenges (Beginner → Advanced)