diff options
-rwxr-xr-x | 1637/main.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/1637/main.py b/1637/main.py new file mode 100755 index 0000000..710b497 --- /dev/null +++ b/1637/main.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +import typing + + +class Solution: + def maxWidthOfVerticalArea(self, points: typing.List[typing.List[int]]) -> int: + p: typing.List[int] = [] + for point in points: + p.append(point[0]) + p.sort() + s = 0 + for i in range(1, len(p)): + s = max(p[i] - p[i - 1], s) + return s + + +def main(): + solution = Solution() + points = [[8, 7], [9, 9], [7, 4], [9, 7]] + print(solution.maxWidthOfVerticalArea(points)) + + +if __name__ == "__main__": + main() |