Posts Tagged ‘hackerrank’

Hackerrank fibonacci lite

by on Thursday, September 15th, 2016

Problem Url: Click Here

This is the solution code related to a problem i found at hackerrank.

$count = 0 ;
$total = 0;
$f1 = 1;
$f2 = 0;
while ($count < $number )
{
$f3 = $f2 + $f1 ;
$total = $f3;
$f1 = $f2 ;
$f2 = $f3 ;
$count = $count + 1;
}
echo $total;