DEV Community

Discussion on: [Challenge] Add numbers without (+-*/)

Collapse
 
domedev94 profile image
domedev94
$a = 2;
$b = 32;
add($a,$b);

function add($n1,$n2){
    return count(array_merge(array_fill(0,$n1,"a"),array_fill(0,$n2,"b")));
}

Enter fullscreen mode Exit fullscreen mode
Collapse
 
nombrekeff profile image
Keff

Nice one!! I also thought of this solution!!! Not very scalable but cool nonetheless