Jumping on the Clouds: Revisited

Sort by

recency

|

1194 Discussions

|

  • + 0 comments

    Thanks, I was trying to resolve it with a for loop, but then I realized the do while was more accurate for this. Using it alongside tools like moi visa check Qatar really helped, and your code is perfect I learned how to implement the do while properly.

  • + 0 comments

    static int jumpingOnClouds(int[] c, int k) { int en = 0; int i = 0; while((i+k)%c.length != 0){ en++; if(c[i%c.length] == 1){ en = en+2 ;

            }
            i=i+k ;
        }
        if(c[c.length-k] == 1 ) en = en+2;
        en++;
        return 100-en;
    }
    
  • + 0 comments
    int jumpingOnClouds(vector<int> c, int k) {
        int e = 100;
        int cloud = 0;
        
        while (e>0) {
            cloud += k;  
            e--;
            
            if(cloud>=c.size()){
                cloud-=c.size();
            }
            
            if(c[cloud]==1){
                e-=2;
            }
            
            if(cloud==0){
                return e;
            }
        }
        
        return e;
    }
    
  • + 0 comments

    Door locks are essential for securing homes, offices, and commercial spaces, offering protection against unauthorized access and enhancing overall safety. Modern locks come in various types, from traditional key-operated to advanced digital and smart systems, catering to different security needs. Jumping on the clouds: revisited, just like exploring new heights requires preparation and awareness, choosing the right door locks ensures your property remains safe, reliable, and protected against potential threats.

  • + 0 comments
    def jumpingOnClouds(c, k):
        t = n = len(c)
        e = 100
        while t > 0:
            t = (t + k) % n
            e -= 3 if c[t] == 1 else 1
        return e