1.
Frequency Count (Counting)
What it does:
Counts how many times elements appear (characters, numbers, etc.)
Problems:
• Check if two strings are anagrams
• Find first non-repeating character
• Remove duplicates / keep only unique elements
• Count frequency of elements
• Can string be rearranged to form a palindrome
• Majority element in an array
2. Two Pointers
What it does:
Use two indices to traverse a structure from both ends or at different speeds
Problems:
• Reverse an array or string
• Check if string is a palindrome
• Merge two sorted arrays
• Remove duplicates in-place
• Move all zeros to end
• Trapping rainwater (advanced)
3. Sliding Window
What it does:
A moving window to find subarrays or substrings with conditions
Problems:
• Longest substring without repeating characters
• Maximum sum subarray of size k
• Minimum window substring
• Count number of anagrams in a string
• Max/Min in every window of size k
4. Hashing (HashMap/Set)
What it does:
Stores key-value or key-only pairs for fast lookup
Problems:
• Detect duplicates
• Find missing or repeating elements
• Group anagrams
• Two-sum (find pair with given sum)
• Longest consecutive sequence
5. Prefix Sum / Cumulative Sum
What it does:
Stores running total to make sum queries fast
Problems:
• Subarray sum equals k
• Range sum queries
• Even-odd prefix count
• Count of subarrays with even sum
6. Sorting + Binary Search
What it does:
Sort first, then apply binary search or logic
Problems:
• Find pair with given difference/sum
• Kth smallest/largest element
• Search in rotated sorted array
• Median of two sorted arrays
7. Recursion / Backtracking
What it does:
Try all possible paths, often with decision trees
Problems:
• Generate all subsets/combinations/permutations
• Sudoku solver
• N-Queens problem
• Word break problem
• Maze solving
8. Greedy Algorithms
What it does:
Make the best choice at every step
Problems:
• Activity selection
• Minimum number of coins
• Fractional knapsack
• Job scheduling
9. Dynamic Programming (DP)
What it does:
Solve complex problems by breaking into smaller overlapping subproblems
Problems:
• Fibonacci (Top-down or Bottom-up)
• 0/1 Knapsack
• Longest Common Subsequence / Substring
• Edit Distance
• DP on trees / grids
10. Stack & Queue Based
What it does:
Use LIFO/FIFO structure for efficient processing
Problems:
• Balanced parentheses
• Stock span problem
• Next greater element
• Sliding window max/min using deque
• LRU Cache
Summary Table:
Technique Example Problems
Frequency Count Anagram check, Character frequency
Two Pointers Palindrome, Reverse array
Sliding Window Longest unique substring, Max subarray sum
HashMap/Set Detect duplicates, Two-sum
Prefix Sum Subarray sum, Even/odd subarrays
Sorting + Binary Kth element, Search problems
Recursion/Backtrack Subsets, N-Queens, Maze
Greedy Activity selection, Coin change
Dynamic Programming LCS, Knapsack, Min steps
Stack/Queue Balanced string, NGE, Window max