Skip to content

Commit e147dcd

Browse files
Create 1637-widest-vertical-area-between-two-points-containing-no-points.java
1 parent b8fb88f commit e147dcd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*--------------------------------
2+
Time Complexity: O(nlog(n))
3+
Space Complexity: O(1)
4+
---------------------------------*/
5+
class Solution {
6+
public int maxWidthOfVerticalArea(int[][] points) {
7+
Arrays.sort(points, (p1, p2) -> p1[0] - p2[0]);
8+
9+
int res = 0;
10+
for(int i = 1; i < points.length; i++){
11+
res = Math.max(res, points[i][0] - points[i-1][0]);
12+
}
13+
return res;
14+
}
15+
}

0 commit comments

Comments
 (0)