Skip to content

Commit

Permalink
Create 1637-widest-vertical-area-between-two-points-containing-no-poi…
Browse files Browse the repository at this point in the history
…nts.java
  • Loading branch information
sujal-goswami authored Dec 21, 2023
1 parent b8fb88f commit e147dcd
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*--------------------------------
Time Complexity: O(nlog(n))
Space Complexity: O(1)
---------------------------------*/
class Solution {
public int maxWidthOfVerticalArea(int[][] points) {
Arrays.sort(points, (p1, p2) -> p1[0] - p2[0]);

int res = 0;
for(int i = 1; i < points.length; i++){
res = Math.max(res, points[i][0] - points[i-1][0]);
}
return res;
}
}

0 comments on commit e147dcd

Please sign in to comment.