We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
static int jumpingOnClouds(int[] c, int k) {
int index =0;
int e =100;
for(int i =0;i<c.length;i++){
index = (index+k)%c.length;
if(c[index]==1){
e = e-3;
}else{
e = e-1;
}
if(index==0){
break;
}
}
return e;
}
Cookie support is required to access HackerRank
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 →
Java 8 Code
// Complete the jumpingOnClouds function below.