MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / choosePivot

Function choosePivot

javascript/0973-k-closest-points-to-origin.js:177–178  ·  view source on GitHub ↗
(points, left, right)

Source from the content-addressed store, hash-verified

175
176// Choose a pivot element of the array
177const choosePivot = (points, left, right) =>
178 points[left + ((right - left) >> 1)];
179
180// Calculate and return the squared Euclidean distance
181const squaredDistance = ([x, y]) => x ** 2 + y ** 2;

Callers 1

partitionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected