• + 0 comments

    C++

    int jumpingOnClouds(vector<int> &c) {
        int cnt = 0;
    
        for (int j = 0; j < c.size() - 1; j = j + 2) {
            if (c[j + 2] == 1) {
                j--;
                cnt++;
            } else { cnt++; }
        }
    
        return cnt;
    }