You are viewing a single comment's thread. Return to all comments →
Java
static int jumpingOnClouds(int[] c, int k) { int energy = 100; boolean stopFlag = true; int index = 0; while(stopFlag){ energy--; if(c[index] == 1){ energy -= 2; } index = (index + k) % c.length; if (index == 0){ stopFlag = false; } } return energy; }
Jumping on the Clouds: Revisited
You are viewing a single comment's thread. Return to all comments →
Java