登录

面试官出的面试题

Html+Css
0 1937
function getParents($b){        if (count($b)>2){                $i = 1;                $bas = [];                $connum = 3*floor(count($b)/3);                foreach ($b as $item=>$value){                        if ($item+1>$connum){                                    array_unshift($bas$value);                    }else{                 if(!($i % 3) == 0){                                    array_push($bas$value);                                }                    }                        $i++;            }                return getParents($bas);                return $b;        }else{                return $b;        }}$b = [1234567];$b = getParents($b);

以上是方法。有问题大家请联系我们,改正

发表评论

0 个回复