K Closest Points to Origin
Try to solve the K Closest Points to Origin problem.
We'll cover the following
Statement
Given a list of points on a plane, where the plane is a 2-D array with (x, y) coordinates, find the closest points to the origin .
Note: Here, the distance between two points on a plane is the Euclidean distance:
Constraints:
-
k
points.length
-
x[i]
,y[i]
Examples
Create a free account to view this lesson.
Continue your learning journey with a 14-day free trial.
By signing up, you agree to Educative's Terms of Service and Privacy Policy