All Patterns
Master 40 patterns across 7 categories. From DSA algorithms to system design, security, AI/ML, and beyond.
Core DSA
Essential 5 patterns covering 60-70% of interview questions
Two Pointers
Use two pointers to traverse an array from different positions, often moving toward each other or in the same direction. Perfect for problems involving pairs, sorted arrays, or in-place modifications.
Mental Model
“Squeezing a toothpaste tube from both ends...”
Sliding Window
Maintain a dynamic window over contiguous elements to efficiently compute aggregates like sum, max, or count. Expand the window by adding elements, shrink by removing.
Mental Model
“A spotlight sliding across a stage...”
Hash Map / Set
Use hash maps for O(1) lookups to track frequencies, find duplicates, store complements, or establish relationships between elements.
Mental Model
“A librarian with perfect memory...”
Fast & Slow Pointers
Two pointers moving at different speeds through a sequence. Fast pointer moves 2x speed of slow. They meet if there's a cycle, or fast reaches the end for middle-finding.
Mental Model
“Tortoise and hare on a circular track...”
Binary Search
Divide and conquer on sorted data. Repeatedly halve the search space by comparing the middle element. Works on sorted arrays, rotated arrays, or any monotonic function.
Mental Model
“Number guessing game...”