diff options
author | terminaldweller <devi@terminaldweller.com> | 2023-12-21 15:33:54 +0000 |
---|---|---|
committer | terminaldweller <devi@terminaldweller.com> | 2023-12-21 15:33:54 +0000 |
commit | 40eec9546cf28ea9e888d406f705f1b7d8d5ff21 (patch) | |
tree | aa2cc03fba69c5e142ad6debd5972edd99a8e909 /1637 | |
parent | 2706 (diff) | |
download | leetcode-40eec9546cf28ea9e888d406f705f1b7d8d5ff21.tar.gz leetcode-40eec9546cf28ea9e888d406f705f1b7d8d5ff21.zip |
1637
Diffstat (limited to '1637')
-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() |