See the two pointers technique step by step: watch left and right close in on a sorted array in an animated Python visualization (Two Sum II, LeetCode 167).
Algorithm Visualization Examples in Python
The algorithm patterns that come up again and again in LeetCode problems and coding interviews. Each example explains the idea, shows a short Python solution and opens it in the visualizer, where you can watch it run line by line: pointers moving over arrays, trees and grids being explored, the call stack growing and shrinking.
Watch a sliding window grow and shrink over a string, step by step, in an animated Python visualization (Longest Substring Without Repeating Characters).
Visualize binary search step by step: see lo, mid and hi move over a sorted array and the search space halve on every comparison (LeetCode 704).
See how reversing a linked list works: watch prev, curr and next move and each arrow flip, step by step, in an animated Python visualization (LeetCode 206).
Visualize breadth-first search on a binary tree: watch the queue and the tree level by level in an animated Python step-by-step trace (LeetCode 102).
Watch breadth-first search flood-fill a 2D grid step by step. An animated Python visualization of Number of Islands (LeetCode 200) with the matrix and queue.
Visualize recursion and backtracking with the call stack: watch every recursive call push and pop while generating all subsets, step by step (LeetCode 78).
See a bottom-up dynamic programming table fill in, step by step. Animated Python visualization of Coin Change (LeetCode 322) with the dp array.