Explore by mechanism
Find the mechanism, then run it
Every mechanism here is something you can watch: a window sliding, a grid filling, a frontier spreading. Pick one, or search for a problem by name.
Mechanisms
All mechanisms →Sliding Window
Runs liveTurn nested-loop scans of contiguous ranges into linear time.
Two Pointers
Runs liveWalk a sorted array from both ends to skip impossible work.
Binary Search
Runs liveHalve the range that can hold the answer, on a sorted array or a range of answers.
Dynamic Programming
Runs liveBreak a problem into overlapping subproblems and reuse the answers.
Backtracking
Runs liveExplore every choice, undo, and prune the dead ends.
Graph Traversal (BFS & DFS)
Runs liveVisit every node once: breadth-first for shortest paths, depth-first for structure.
Topological Sort
Runs liveOrder tasks so every dependency comes before what needs it.
Heap / Priority Queue
Runs liveAlways pull the smallest or largest element in log time.
Monotonic Stack
Runs liveKeep a stack in sorted order to find next-greater elements in one pass.
Prefix Sums
Runs livePrecompute running totals to answer range queries in O(1).
Hashing & Frequency Maps
Runs liveTrade memory for O(1) lookups, counts, and dedupe.
Fast & Slow Pointers
Runs liveTwo speeds through a sequence to find cycles and midpoints.
Intervals
Runs liveSort by start, then sweep to merge or schedule overlaps.