Rache
0
Q:

jumping on the clouds revisited hackerrank solution in javascpt

function jumpingOnClouds(c, k) {  let energy = 100;  let count = 0;  let index;  while (index !== 0 && energy >= 0) {    count === 0 && (index = 0);    index = (index + k) % c.length;    energy = c[index] > 0 ? energy - 3 : energy - 1;    count++;  }  return energy;}
0

New to Communities?

Join the community