1. Code
class Solution:
def maxWidthOfVerticalArea(self, points: List[List[int]]) -> int:
xs = sorted(x for x,y in points) # Extract only the x-coordinates because you need to find neighboring x-coordinates that make the biggest difference among x-coordinates.
maxlen = 0
for i in range(len(xs)-1): # Find two points that show the biggest difference.
maxlen = max(maxlen, xs[i+1]-xs[i])
return maxlen
2. Result
Runtime : 828 ms(75.49%), Memory usage : 55.3 MB(15.92%)
(Runtime can be different by a system even if it is a same code.)