You are viewing a single comment's thread. Return to all comments →
here is my solution
$total = count($container); $capacityArray = array(); $indexArray = array(); for ($i=0; $i < $total; $i++) { $sum = array_sum($container[$i]); $capacityArray[] = $sum; $indexSum = 0; for ($j=0; $j < $total ; $j++) { $indexSum+= $container[$j][$i]; } $indexArray[] = $indexSum; } sort($capacityArray); sort($indexArray); $result = ''; if ($capacityArray == $indexArray) { $result = 'Possible'; } else { $result = 'Impossible'; } echo $result;
Seems like cookies are disabled on this browser, please enable them to open this website
Organizing Containers of Balls
You are viewing a single comment's thread. Return to all comments →
here is my solution