Skip to content

Commit 976ac80

Browse files
committed
Changed back to original variable names and formatting in video.
1 parent cea45e8 commit 976ac80

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
class Solution:
22
def kClosest(self, points: List[List[int]], k: int) -> List[List[int]]:
3-
pts = []
3+
minHeap = []
44
for x, y in points:
5-
dist = x ** 2 + y ** 2
6-
pts.append((dist, x, y))
5+
dist = (x ** 2) + (y ** 2)
6+
minHeap.append((dist, x, y))
77

8-
heapq.heapify(pts)
8+
heapq.heapify(minHeap)
99
res = []
1010
for _ in range(k):
11-
_, x, y = heapq.heappop(pts)
11+
_, x, y = heapq.heappop(minHeap)
1212
res.append((x, y))
1313
return res

0 commit comments

Comments
 (0)