diff --git a/solutions/034.md b/solutions/034.md index d93b552..6574b8b 100644 --- a/solutions/034.md +++ b/solutions/034.md @@ -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: @@ -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.