- 1
The Priority Queue
What a heap actually guarantees — and why keeping only partial order makes it fast.
Multiple choiceTap - 2
Kth Largest in a Stream
Cap a min-heap at k elements — its top is always the kth largest, no matter how much streams past.
Complete codeDebugMultiple choiceTrace - 3
Last Stone Weight
Simulate with a max-heap: pop the two heaviest, push back the difference — never re-sort.
DebugCode orderMultiple choiceTrace - 4
Kth Largest in an Array
Keep only the k largest in a min-heap — pay log k per element, not log n.
Complete codeMultiple choiceTrace - 5
Top K Frequent Elements
Count first, then heap the pairs — and order the heap by COUNT, never by value.
Complete codeMultiple choiceTrace - 6
K Closest Points to Origin
Keep the k closest by evicting the farthest — a MAX-heap, the mirror image of top-K largest.
Complete codeDebugMultiple choiceTrace - 7
Heap & Top-K CheckpointCheckpoint
No new concepts — combine the island's heap moves: pick the right heap kind, run the size-k eviction, and catch the classic wrong-heap bug.
DebugCode orderFill blankMultiple choiceTrace - 8
Heap & Top-K ReviewReview
Mixed recap of the island: what a heap actually promises, size-k eviction, max-heap simulation, 'worst on top' comparators, and the cost of top-K.
Complete codeDebugMultiple choiceTapTrace - 9
Boss: Median from a StreamBoss
Two heaps split the stream down the middle — a max-heap holds the smaller half, a min-heap the larger — so both middle values wait at the tops.
Complete codeDebugCode orderMultiple choiceTrace
Search & Priority Patterns is part of AlgoFox Pro
You can read the whole course outline here. The exercises are in the app, along with your streak, your mistake review, and the progress that carries across your devices.
Pro starts with a 3 day free trial. The app store decides who is eligible for an introductory offer, and a lapsed subscription does not get another one.
Already subscribed in the app? Sign in with the same account and Pro works here too. Quick Play and Battle are free on the web, and so is the first course in every subject.
