Skip to content

Commit efe171d

Browse files
authored
Update count-number-of-rectangles-containing-each-point.py
1 parent cd752ef commit efe171d

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Python/count-number-of-rectangles-containing-each-point.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,5 @@ def countRectangles(self, rectangles, points):
1818
buckets[y].append(x)
1919
for bucket in buckets:
2020
bucket.sort()
21-
result = []
22-
for x, y in points:
23-
cnt = 0
24-
for y in xrange(y, max_y+1):
25-
cnt += len(buckets[y])-bisect.bisect_left(buckets[y], x)
26-
result.append(cnt)
27-
return result
21+
return [sum(len(buckets[y])-bisect.bisect_left(buckets[y], x) for y in xrange(y, max_y+1))
22+
for x, y in points]

0 commit comments

Comments
 (0)