function king($high,$size){
$monkey = range(1, $high);
$i = 0 ;
while (count($monkey)>1) {
$i++;
$head = array_shift($monkey);
if(($i % $size) != 0){
array_push($monkey,$head);
}
}
return $monkey[0];
}
var_dump(king(10,3));
function king($high,$size){
$monkey = range(1, $high);
$i = 0 ;
while (count($monkey)>1) {
$i++;
$head = array_shift($monkey);
if(($i % $size) != 0){
array_push($monkey,$head);
}
}
return $monkey[0];
}
var_dump(king(10,3));