You are viewing a single comment's thread. Return to all comments →
here is my php solution arr);
for (`$i=0; $`i < `$n && $`k>0 ; $i++) { if (`$arr[$`i] == `$n-$`i) { continue; } `$swapElement2Index = array_search($`n-`$i, $`arr); `$arr[$`swapElement2Index] = `$arr[$`i]; `$arr[$`i] = `$n-$`i; $k--; }
return $arr;
Seems like cookies are disabled on this browser, please enable them to open this website
Largest Permutation
You are viewing a single comment's thread. Return to all comments →
here is my php solution arr);
return $arr;