DSA Pattern-wise Classification of Problems
Sliding Window - Fixed Size
1 Maximum Sum Subarray of Size K
2 Number of Subarrays with Product Less Than K (can be fixed/variable depending on solution)
Sliding Window - Variable Size
1 Longest Substring with K Distinct Characters
2 Minimum Size Subarray Sum ≥ Target
3 Longest Substring with All Unique Characters
4 Maximum Length Subarray With Sum ≤ K
HashMap / Prefix Sum Pattern
1 Number of Subarrays with Sum K
2 Longest Subarray with Equal 0s and 1s
3 Subarray Sums Divisible by K
4 Count Subarrays With Given XOR
Kadane / Maximum Subarray
1 Find Maximum Sum Subarray (Kadane's Algorithm)
2 Longest Mountain in Array (Kadane-style segments)
Two Pointer / Sorting Based
1 3Sum Problem
2 4Sum Problem
3 Container With Most Water
4 Trapping Rain Water
5 Merge Intervals
6 Count Pairs with Given Sum
7 Check if Array is a Rotation of Another
8 Minimum Number of Platforms
9 Sort Colors (Dutch National Flag Problem)
Binary Search / Binary Search on Answer
1 Median of Two Sorted Arrays
2 Find Kth Smallest Element in Two Sorted Arrays
3 Search in Rotated Sorted Array
4 Find Minimum in Rotated Sorted Array
5 Peak Element in Array
6 Aggressive Cows / Allocate Minimum Number of Pages
7 Split Array to Minimize Largest Sum
8 Find Position to Insert Element in Sorted Array
Greedy
1 Jump Game I
2 Jump Game II
3 Gas Station Problem
4 Candy Distribution Problem
5 Partition Labels
6 Remove K Digits to Make Smallest Number
7 Wiggle Sort II
1D Dynamic Programming
1 Jump Game (DP version)
2 Jump Game II
3 Split Array Largest Sum
4 Longest Mountain (DP version)
Matrix / 2D Programming
1 Search in a 2D Matrix
2 Set Matrix Zeroes
3 Spiral Matrix Traversal
4 Rotate Image 90° Clockwise
5 Word Search in Matrix
6 Longest Increasing Path in Matrix
7 Sudoku Solver
8 Kth Smallest Element in a Sorted Matrix
9 Maximum Area of Island
10 Number of Islands