How to prepare
The AlgoPath blog has 28 articles in “How to prepare”, newest first, written for developers without a CS degree.
Sliding window algorithm: the template, Python code and how to spot it in a problem
Two indexes that only move right turn longest-substring and smallest-subarray problems into O(n). Trigger words, the template, Python code, a traced run and Minimum Window Substring.
2026-10-14
Dijkstra's algorithm in Python: shortest paths with a heap in O((V + E) log V)
How Dijkstra finds shortest paths in a weighted graph, why the greedy pick is safe, Python code with heapq, a traced run, and Network Delay Time.
2026-10-11
Priority queue in Python: heapq, the size-k trick and when a problem needs one
heapq turns a list into a min-heap with O(log n) push and pop. The API table, the max-heap trick, tuples for priorities, Top K Frequent Elements and Merge k Sorted Lists.
2026-10-09
Binary search on the answer: the pattern behind minimum speed and smallest capacity
When you cannot compute the answer but can verify a guess, search the range of answers. The check function, the bounds, Python code and Koko Eating Bananas traced by hand.
2026-10-07
Monotonic stack in Python: next greater element in O(n) and the loop to memorise
A stack that stays sorted answers next greater and next smaller for every index in one pass. Trigger words, the loop, Python code, the direction table and Largest Rectangle in Histogram.
2026-10-04
Merge sort vs quicksort: which one to write in an interview and why
Both split and conquer in O(n log n), but they differ on stability, memory and the worst case. Python code for both, the table that settles the choice, and the merge-sort counting trick.
2026-10-02
Fast and slow pointers: cycle detection and the middle of a list in O(1) space
Two pointers at speeds one and two find a cycle, its start, and the middle node without extra memory. The wording that calls for it, Python code, the proof, and Find the Duplicate Number.
2026-09-30
Trie in Python: how a prefix tree works and when a problem needs one
A trie stores words letter by letter and answers prefix questions in O(L). The Python class, how it differs from a hash set, the wording that calls for it, and Word Search II worked through.
2026-09-28
Union-Find in Python: what it is and when a problem needs it
Union-Find tracks which elements share a group and merges groups in near O(1). The Python class with path compression and union by size, the wording that calls for it, and the four mistakes that cost the most.
2026-09-27