You are viewing a single comment's thread. Return to all comments →
Solution in JavaScript
function jumpingOnClouds(c, k) { let energy = 100; let position = 0; do{ position = (position + k) % c.length; energy -= 1; if (c[position] === 1){ energy -= 2; } } while (position !== 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 →
Solution in JavaScript