75. Sort Colors
class Solution {
/**
* @param Integer[] $nums
* @return NULL
*/
function sortColors(&$nums) {
if (count($nums) <= 1) {
return $nums;
}
foreach($nums as $currentKey => $cunnentNum) {
foreach($nums as $nextKey => $nextNum) {
if ($nums[$currentKey] < $nums[$nextKey]) {
[$nums[$currentKey], $nums[$nextKey]] = [$nums[$nextKey], $nums[$currentKey]];
}
}
}
return 'gg';
}
}
Last updated