Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions solutions/034.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ To summarize:

The algorithm has a time complexity that grows logarithmically with the number of points. It is efficient for processing a moderate number of points, but as the number of points increases significantly, the sorting step becomes more time-consuming.

#### Python3
```python3
class Solution:
def maxWidthOfVerticalArea(self, points: List[List[int]]) -> int:
Expand All @@ -69,4 +70,28 @@ class Solution:
return maximum
```

#### PHP
```php
class Solution {

/**
* @param Integer[][] $points
* @return Integer
*/
function maxWidthOfVerticalArea($points) {
usort($points, function($a, $b){
return $a[0] > $b[0] ? 1 : -1;
});

$max = 0;
$n = count($points);
for($i = 0; $i < $n - 1; $i++){
$max = max($max, $points[$i + 1][0] - $points[$i][0]);
}

return $max;
}
}
```

***NB***: If you want to get community points please suggest solutions in other languages as merge requests.