K Closest Points to a Location

Given n points on a plane, a target location (x0, y0), and an integer k, return the k points closest to the target.

Use squared Euclidean distance:

(x - x0)^2 + (y - y0)^2

The o...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: