Skip to content

Commit b22b6f0

Browse files
authored
Create widest-vertical-area-between-two-points-containing-no-points.py
1 parent 5a70298 commit b22b6f0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Time: O(nlogn)
2+
# Space: O(n)
3+
4+
import itertools
5+
6+
7+
class Solution(object):
8+
def maxWidthOfVerticalArea(self, points):
9+
"""
10+
:type points: List[List[int]]
11+
:rtype: int
12+
"""
13+
sorted_x = sorted({x for x, y in points})
14+
return max([b-a for a, b in itertools.izip(sorted_x, sorted_x[1:])] + [0])

0 commit comments

Comments
 (0)