fork download
  1. <?php
  2. function twoMax(Array $arr) {
  3. $result = [];
  4. while (count($result) !== 2 && !empty($arr) ) {
  5. $max = max($arr);
  6. $result[] = $max;
  7. $arr = array_diff($arr, $result);
  8. }
  9. return $result;
  10. }
Success #stdin #stdout 0.01s 24400KB
stdin
Standard input is empty
stdout
Standard output is empty