0) { $ans[$k++] = $v; } } for ($i = 0; $i < $n; $i++) { while (isset($cnt[$i]) && $cnt[$i]-- > 0) { $ans[$k++] = $i; } } return $ans; } }