Skip to content

Commit 007885a

Browse files
authored
Update k-closest-points-to-origin.py
1 parent b4992c5 commit 007885a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/k-closest-points-to-origin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def PartitionAroundPivot(left, right, pivot_idx, nums, compare):
3838
else: # new_pivot_idx < k.
3939
left = new_pivot_idx + 1
4040

41-
kthElement(points, K, lambda a, b: dist(a) < dist(b))
41+
kthElement(points, K-1, lambda a, b: dist(a) < dist(b))
4242
return points[:K]
4343

4444

0 commit comments

Comments
 (0)