The blog
Pattern recognition, one problem at a time
Guides to the patterns, decisions, and reference material that turn brute-force grinding into pattern-fluent interview prep.
- Aug 1, 20268 min readprefix sum
Prefix Sum Pattern — Range Queries, Hashmap Trick, Three Walkthroughs
A pattern-recognition guide to the prefix sum technique — why it collapses O(n) range-sum queries into O(1), how the hashmap variant handles subarray-sum-equals-k, and how it applies to LeetCode 303, 560, and 974.
- Jul 31, 20269 min readtrie
Trie Fundamentals — Recognition, Template, Three Walkthroughs
A pattern-recognition guide to the trie (prefix tree) data structure — why it beats hash sets for prefix queries, how the template composes with DFS for autocomplete and word search, and how it applies to LeetCode 208, 211, and 212.
- Jul 30, 20268 min readfast slow pointers
Fast/Slow Pointers — Tortoise and Hare, Cycle Detection, Three Walkthroughs
A pattern-recognition guide to the fast/slow pointer technique — why Floyd's tortoise-and-hare detects cycles in O(1) space, how to find the cycle's start, and how it applies to LeetCode 141, 142, and 202.
- Jul 29, 20265 min readdp memoization vs tabulation
DP Memoisation vs Tabulation — Top-Down vs Bottom-Up, and When Each Wins
The trade-off between top-down (memoisation) and bottom-up (tabulation) dynamic programming — clarity vs space optimisation, natural recursion vs cache-friendly loops, and when to convert between them.
- Jul 28, 20265 min readdfs vs backtracking
DFS vs Backtracking — The Distinction That Trips Most Candidates
The subtle difference between DFS and backtracking — one visits every reachable node once; the other explores a decision tree with explicit choose/undo — with the recognition signals that pick each on a whiteboard.
- Jul 27, 20269 min readsorting
Sorting Algorithms Comparison Table — Complexity, Stability, In-Place, and When to Use Each
A reference table comparing insertion, selection, merge, quicksort, heapsort, counting, radix, and Timsort — with the language-specific defaults (Timsort in Python and Java 8+, dual-pivot Quicksort for Java int[], IntroSort in C++) and when each algorithm actually wins.
- Jul 26, 202611 min readjavascript
JavaScript Interview Cheat Sheet — Map, Set, Array, and the Gotchas That Bite Candidates
The JavaScript idioms, built-in Map/Set/Array APIs, and language gotchas that show up in coding interview solutions — Array.shift's accidental O(n²), the missing heap and deque, and Object[k] polymorphic-cache traps.
- Jul 25, 202612 min readjava
Java Interview Cheat Sheet — Collections, Streams, and the Gotchas That Bite Candidates
The Java Collections framework, Streams API, and language gotchas that show up in coding interview solutions — HashMap tree buckets, ArrayList vs LinkedList, PriorityQueue comparators, StringBuilder rules — organised for whiteboard recall.
- Jul 24, 202610 min readdynamic programming
Dynamic Programming — How to Define the State, Three Walkthroughs
A pattern-recognition guide to the hard part of dynamic programming — naming the state, writing the transition, choosing the base case — with worked examples on LeetCode 198, 300, and 322.
- Jul 23, 20269 min readtopological sort
Topological Sort Template — Kahn's Algorithm and DFS Post-Order, Three Walkthroughs
A pattern-recognition guide to topological sort — the two canonical implementations (Kahn's BFS-based algorithm and DFS post-order), how they detect cycles, and how they apply to LeetCode 207, 210, and 269.
- Jul 22, 20269 min readunion find
Union-Find Explained — Path Compression, Union by Rank, Three Walkthroughs
A pattern-recognition guide to the union-find (disjoint-set-union) data structure — why path compression and union by rank make it nearly O(1) per operation, and how it applies to LeetCode 200, 547, and 684.
- Jul 21, 20265 min readstack vs queue
Stack vs Queue — When to Use Which, and What Each Enables
The decision between stack and queue in interview code — LIFO vs FIFO, DFS vs BFS, matching problems vs streaming — with the recognition signals that pick the right container in one line.
- Jul 20, 20265 min readarray vs linked list
Array vs Linked List for Interviews — When to Use Which, and Why Array Almost Always Wins
The trade-off between arrays (dynamic arrays) and linked lists in coding interviews — random access vs constant-time insertion, cache locality vs pointer chasing, and the small set of problems where linked list actually earns its keep.
- Jul 19, 20265 min readiterative vs recursive dfs
Iterative vs Recursive DFS — When Each Wins, and How to Convert Between Them
The trade-off between recursive and iterative depth-first search — call-stack cost, stack-overflow risk on adversarial inputs, and when the iterative form is the interview-safe default.
- Jul 18, 20265 min readheap vs sorted list
Heap vs Sorted List — When to Use Each, with Complexity and Worked Examples
The subtle difference between a binary heap and a sorted list — one gives O(1) access to just the extreme, the other maintains full order at higher insertion cost — with the recognition signals that pick the right one for streaming top-k, median-finding, and range queries.
- Jul 17, 20265 min readhash map vs hash set
Hash Map vs Hash Set — When to Use Which, and Why the Distinction Matters
The subtle difference between hash map and hash set — one associates values with keys, the other only tracks membership — with the recognition signals that pick each one on a whiteboard.
- Jul 16, 20265 min readsliding window vs two pointer
Sliding Window vs Two-Pointer — When to Use Which, and Why They're Confused
The subtle distinction between sliding window and two-pointer — one contiguous range that grows and shrinks, the other a pair converging on a relation — with the recognition signals that pick each one on a whiteboard.
- Jul 15, 20269 min readspace complexity
Space Complexity Explained — With Examples for Every Interview Pattern
A worked-example reference for space complexity — what actually counts, why the recursion stack is O(depth) not O(1), how to trade time for space with rolling arrays, and how to argue it under interview pressure.
- Jul 14, 202610 min readcomplexity
Time Complexity of Common Operations — Python, Java, JavaScript, C++
A per-language time-complexity reference for the data-structure operations coding interviews actually test — dict / HashMap / Map / unordered_map, list / ArrayList / Array / vector, and the deque, heap, and sorted-structure lines side by side.
- Jul 13, 202612 min readpython
Python Interview Cheat Sheet — Data Structures, Standard Library, Idioms, and Gotchas
The Python idioms, standard-library shortcuts, and language gotchas that show up in coding interview solutions — a cheat sheet organised for whiteboard recall, with the traps (mutable defaults, list.pop(0), late-binding closures) generic references skip.
- Jul 12, 20269 min readbfs vs dfs
BFS vs DFS — When to Use Which Traversal, with Three Walkthroughs
A pattern-recognition guide to choosing between breadth-first and depth-first search — the invariant each preserves, when queues beat stacks (and vice versa), and how it applies to LeetCode 102, 200, and 133.
- Jul 11, 202610 min readbig o
Big O Cheat Sheet — Data Structures, Algorithms, and Language Gotchas
A canonical Big-O cheat sheet for coding interview prep — data structure operations, sorting and graph algorithm complexities, and per-language notes for Python, Java, and JavaScript that generic cheat sheets leave out.
- Jul 10, 20269 min readbacktracking
Backtracking Template — Recognition, Choose/Undo Rhythm, Three Walkthroughs
A pattern-recognition guide to backtracking — why it's just DFS with explicit state, how the choose/undo rhythm keeps your state clean, and how it applies to LeetCode 78, 46, and 51.
- Jul 9, 20269 min readmonotonic stack
Monotonic Stack Explained — Pending Questions, Two Directions, Three Walkthroughs
A pattern-recognition guide to the monotonic stack — why it turns O(n²) 'next greater' problems into O(n), when the stack should be increasing vs decreasing, and how it applies to LeetCode 496, 739, and 84.
- Jul 8, 20269 min readbinary search
Binary Search Template — Recognition, Boundary Rule, Three Walkthroughs
A pattern-recognition guide to binary search — when the boundary template beats the classic one, why binary search on answer works on optimisation problems, and how it applies to LeetCode 704, 153, and 1011.
- Jul 7, 20268 min readtwo pointer
Two-Pointer Technique — Recognition, Move Rules, Three Walkthroughs
A pattern-recognition guide to the two-pointer technique — when to reach for it, how to decide which pointer moves, and how it applies to LeetCode 125, 11, and 15.
- Jul 6, 20269 min readsliding window
Sliding Window Technique — Recognition, Template, Three Walkthroughs
A pattern-recognition guide to the sliding window: when to reach for it, why it collapses O(n²) brute force into O(n), and how it applies to LeetCode 209, 3, and 76.