You are viewing a single comment's thread. Return to all comments →
java 8
public static int jumpingOnClouds(List<Integer> c) { // Write your code here int jump = 0; int start = 0; while (start < c.size() - 1) { if (start == c.size() - 2) { jump++; break; } int idx = (c.get(start + 2) != 0) ? 1 : 2; start += idx; jump++; } return jump;
Seems like cookies are disabled on this browser, please enable them to open this website
Jumping on the Clouds
You are viewing a single comment's thread. Return to all comments →
java 8