Whitespace helps too! And I think using `sorted(key=)` is more Pythonic than a generator expression ;)
from operator import itemgetter
def maxWidthOfVerticalArea(self, points: List[List[int]]) -> int:
xs = sorted(points, key=itemgetter(0))
x_pairs = zip(xs, xs[1:])
widths = (right-left for left, right in x_pairs)
return max(widths)
NumPy also has stuff to solve this sort of thing built-in: from numpy import diff
def maxWidthOfVerticalArea(self, points: List[List[int]]) -> int:
xs = sorted(points, key=itemgetter(0))
widths = diff(xs)
return widths.max()