Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/neetcode-gh/leetcode
/ distance
Function
distance
javascript/0937-k-closest-points-to-origin.js:9–9 ·
view source on GitHub ↗
([x, y])
Source
from the content-addressed store, hash-verified
7
*/
8
var
kClosest =
function
(points, K) {
9
const
distance = ([x, y]) => x * x + y * y;
10
11
points.sort((a, b) => distance(a) - distance(b));
12
Callers
1
kClosest
Function · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected