Skip to content

Commit 0c52921

Browse files
authored
Update Solution.go
1 parent b40e92a commit 0c52921

File tree

1 file changed

+2
-3
lines changed
  • solution/0900-0999/0973.K Closest Points to Origin

1 file changed

+2
-3
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
func kClosest(points [][]int, k int) [][]int {
22
sort.Slice(points, func(i, j int) bool {
3-
a, b := points[i], points[j]
4-
return a[0]*a[0]+a[1]*a[1] < b[0]*b[0]+b[1]*b[1]
3+
return math.Hypot(float64(points[i][0]), float64(points[i][1])) < math.Hypot(float64(points[j][0]), float64(points[j][1]))
54
})
65
return points[:k]
7-
}
6+
}

0 commit comments

Comments
 (0)