Back to Questions

K Closest Points to Origin

81.1K viewsAsked at Netflix
Medium

Question Explain

Given an array of points on a 2D plane, find the $K$ closest points to the origin $(0, 0)$. Use a Max-Heap (Priority Queue) to maintain the $K$ smallest distances in $O(n \log k)$.

Start Trying This Question Simulation

Practice answering orally or with text to get instant AI feedback.

Practice with This Question