You are viewing a single comment's thread. Return to all comments →
Solution in JS
function jumpingOnClouds(c, k) { let n = c.length; let i = k >= n ? Math.abs(n - k) : k; let e = 100 - (c[i] === 0 ? 1 : 3); while(i != 0 || e <= 0){ i = i + k; if(i >= n){ i = Math.abs(n - i); } if(c[i] === 0){ e--; } else{ e = e - 3; } } return e >= 0 ? e : 0; }
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 JS