You are viewing a single comment's thread. Return to all comments →
Solution for c#
public static int jumpingOnClouds(List<int> c) { int jumpCount = 0; int zeroCount = 0; for (int x = 0; x < c.Count; x++) { if (c[x] == 0) { zeroCount++; if (x == c.Count -1) { int quotient = (int)(zeroCount / 2); jumpCount = jumpCount + quotient; } } else if (c[x] > 0 || x == c.Count -1) { int quotient = (int)(zeroCount / 2) + 1; jumpCount = jumpCount + quotient; zeroCount = 0; } } return jumpCount; }
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 →
Solution for c#