■ Master Coding Problem List
1. Arrays & Strings
1 Reverse a string
2 Check palindrome (string, ignoring non-alphanumerics)
3 First non-repeating character
4 Anagram check (two strings permutations)
5 Count character frequencies / vowels / consonants
6 Implement substring search (strstr / KMP-lite)
7 Two-sum problem (hashmap / two pointers)
8 Pair with given sum in sorted array (two pointers)
9 Remove duplicates from sorted array (in-place)
10 Move zeroes to end (stable)
11 Rotate array by k steps (cyclic)
12 Maximum subarray sum (Kadane’s algorithm)
13 Subarray with given sum (sliding window / hashmap)
14 Prefix sums + range queries
15 Count subarrays with sum = k
16 Longest substring without repeating characters (sliding window)
17 Majority element (Boyer-Moore voting)
18 Stock buy and sell (max profit once / twice)
19 Trapping rain water (two pointers)
20 Sort 0s,1s,2s (Dutch national flag)
21 Find missing number in 1..n (xor/sum)
22 Find duplicate number in 1..n (Floyd cycle detection)
2. Linked Lists
1 Reverse a linked list (iterative + recursive)
2 Detect cycle in linked list (Floyd’s tortoise-hare)
3 Merge two sorted linked lists
4 Remove nth node from end
5 Intersection of two linked lists
6 Add two numbers (linked list representation of big integer)
3. Trees & Graphs
1 Binary search (basic + rotated array)
2 Binary tree traversals (inorder, preorder, postorder)
3 Level-order traversal (BFS)
4 Height / balanced tree check
5 Lowest common ancestor (basic recursive)
6 Diameter of binary tree
7 BFS/DFS on graph (connected components)
8 Shortest path in unweighted graph (BFS)
9 Detect cycle in undirected graph (DFS / Union-Find)
10 Topological sort (Kahn’s algorithm / DFS)
4. Dynamic Programming / Greedy
1 Fibonacci (DP / memoization)
2 Coin change (count ways / min coins, small constraints)
3 0/1 Knapsack
4 Longest increasing subsequence (O(n log n))
5 Longest common subsequence (LCS)
6 Edit distance (Levenshtein distance)
7 Matrix chain multiplication
8 Activity selection (greedy interval scheduling)
5. Miscellaneous / Implementation
1 Count set bits, basic bit manipulation (xor tricks)
2 Fast exponentiation / modular exponentiation
3 GCD / LCM, sieve of Eratosthenes for primes
4 K-th largest element (heap or quickselect)
5 Array partition around pivot (quickselect idea)
6 Matrix traversal (spiral, transpose)
7 String decoding (“3[a]2[bc]”)
8 Balanced parentheses check (stack)
9 Min stack / queue with O(1) getMin
10 Generate balanced parentheses of size n (backtracking)
11 N-Queens problem
12 Sudoku solver (backtracking)