This theory is part of Premium
The full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricingKeep a K-sized max-heap of the closest points seen so far.
What this asks
Return the K points nearest the origin.
A K-sized max-heap of distances evicts the farthest point as closer ones arrive.
The full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricing