You are viewing a single comment's thread. Return to all comments →
My C++ Solution:
int jumpingOnClouds(vector<int> c) { int jumps = 0; for(int i=0;i < c.size();){ if(i == (c.size()-1))return jumps; if(c[i+2] == 0){ i +=2; }else{ i += 1; } jumps++; } return jumps; }
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Jumping on the Clouds
You are viewing a single comment's thread. Return to all comments →
My C++ Solution: