K Closest Points to Origin
Return the k points nearest the origin. Why a max-heap of size k beats sorting everything, and why the heap's top is always the point to throw out.
Spotted a mistake in this lesson?Report an issue →
Return the k points nearest the origin. Why a max-heap of size k beats sorting everything, and why the heap's top is always the point to throw out.