59
TechniqueIdeaExamples
Brute forceTry every possibilityLinear search, all pairs
Divide and ConquerSplit into independent parts, solve, combineMerge sort, quick sort, binary search
GreedyTake the best choice at each stepActivity selection, Kruskal, Prim, Dijkstra, Huffman
Dynamic ProgrammingOverlapping subproblems, store answersFibonacci, knapsack, LCS, coin change
BacktrackingBuild a solution, undo when it failsN-Queens, Sudoku, subsets, permutations
Two pointers / Sliding windowMove indices over an array instead of nested loopsPair sum, longest substring

Q & A

  1. Greedy vs DP?
    Greedy makes one local choice and never looks back, so it is fast but only correct for some problems. DP tries all choices of subproblems and reuses stored answers, so it is always correct when the problem has optimal substructure.