diff --git a/solutions/032.md b/solutions/032.md index 557cd73..5d45577 100644 --- a/solutions/032.md +++ b/solutions/032.md @@ -65,7 +65,7 @@ The sortTheStudents method takes a `list` of lists called `score`, where each in In summary, the code sorts the `score` list of students based on a specific score index `k` in descending order. The time complexity is typically O(n log n), and the space complexity is O(1). -#### Ptyhon3 +#### Python3 ```python3 class Solution: @@ -73,4 +73,21 @@ class Solution: return sorted(score, key=lambda x: x[k], reverse=True) ``` +#### PHP +```php +class Solution { + + /** + * @param Integer[][] $score + * @param Integer $k + * @return Integer[][] + */ + function sortTheStudents($score, $k) { + uasort($score, function ($studentA, $studentB) use($k) { + return ($studentA[$k] > $studentB[$k]) ? -1 : 1; + }); + return $score; + } +} +``` ***NB***: If you want to get community points please suggest solutions in other languages as merge requests.