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.
// Complete the jumpingOnClouds function below.staticintjumpingOnClouds(int[]clouds,intjumpLength){intenergy=100;intcloudsLength=clouds.length;intcloudOn=0;do{cloudOn=(cloudOn+jumpLength)%cloudsLength;if(clouds[cloudOn]==1)energy-=3;elseenergy-=1;}while(cloudOn!=0);returnenergy;}
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 →
Readable Java 8 Solution: