Jumping on the Clouds: Revisited

  • + 0 comments

    Here is my c++ solution, you can watch the explanation here : https://youtu.be/retgbr5jSsg

    int jumpingOnClouds(vector<int> c, int k) {
        int position = 0, energie = 100;
        do{
            position = (position + k) % c.size();
            energie -= 1 + c[position] * 2;
        }while(position != 0);
        return energie;
    }