60. K Closest Points to the Origin
MediumPriority queues & heaps
Return the k points closest to (0, 0) by Euclidean distance. Order them by distance, breaking ties by x then y.
Example 1
Input: points = [[1, 3], [-2, 2]], k = 1 Output: [[-2, 2]]
Constraints
1 ≤ k ≤ points.length ≤ 10⁴