You are viewing a single comment's thread. Return to all comments →
PHP
function jumpingOnClouds($c, $k) { $energy = 100; $n = sizeof($c); $cloud = 0; do { $cloud = ($cloud + $k) % $n; if ($c[$cloud] == 1) { $energy = $energy - 3; } else { $energy--; } } while($cloud != 0); return $energy; }
Seems like cookies are disabled on this browser, please enable them to open this website
Jumping on the Clouds: Revisited
You are viewing a single comment's thread. Return to all comments →
PHP