Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers
by nazar on Thursday January 05, 2012 @05:13PM
(#3430809)
PHP Version I came up with. Took more than 10 minutes tho...
for ($i=0; $i<=10; $i++)
{
if ($i== 0)
$row[$i] = array(0, 1, 0);
else {
$row[$i] = array();
array_push($row[$i], 0);
for($j = 0; $j<count($row[$i-1]); $j++) {
$someval = $row[$i-1][$j]+$row[$i-1][$j+1];
array_push($row[$i], $someval);
}
}
for($k = 1; $k<count($row[$i])-1; $k++) {
echo $row[$i][$k];
}
echo "<br />";
}
[ Parent
| on HN ]
There are no comments on this comment yet.