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