From 40eec9546cf28ea9e888d406f705f1b7d8d5ff21 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Thu, 21 Dec 2023 10:33:54 -0500 Subject: 1637 --- 1637/main.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 1637/main.py 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() -- cgit v1.2.3