(0, 0). You are given a list of points spots, where spots[i] = [x, y], and a number count. Return the count points closest to the base by ordinary (Euclidean) distance.
The answer set is guaranteed to be unique: the point in position count by distance is strictly closer than the next one. The points may be returned in any order.spots=[[1, -2], [3, 0], [0, 1]], count=2 → [[0, 1], [1, -2]]
The squared distances to the base are 5, 9 and 1, so the two nearest points are [0, 1] and [1, -2].
spots=[[-4, 4], [2, 5]], count=1 → [[2, 5]]
16 + 16 = 32 versus 4 + 25 = 29, so [2, 5] is slightly closer.
count nearest points is uniquespots=[[1, -2], [3, 0], [0, 1]], count=2
[[0, 1], [1, -2]]
Run checks the first 3 tests in your browser. Submit checks all 72 tests on the server, hidden ones included.