1742. Widest Vertical Area Between Two Points Containing No Points
My accepted Python solution to LeetCode problem 1742, Widest Vertical Area Between Two Points Containing No Points, running in 42ms.
- Difficulty: Easy
- Python
- Runtime 42ms
- Memory 49.9MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 42ms, memory 49.9MB, accepted 2025-12-29.
class Solution:
def maxWidthOfVerticalArea(self, points: List[List[int]]) -> int:
x_coords = sorted([p[0] for p in points])
max_width = 0
for i in range(1, len(x_coords)):
max_width = max(max_width, x_coords[i] - x_coords[i-1])
return max_width