Jumping on the Clouds: Revisited

Sort by

recency

|

1192 Discussions

|

  • + 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
    
  • + 0 comments

    To be honest the discription is really bad.

  • + 0 comments

    My python solution

    	```
    i =k
    	e = 100
    	if c[0] == 1:
    			e -= 3
    	else:
    			e -= 1
    	if len(c)== k:
    			return e
    	while k != 0:
    			if c[k] == 1:
    					e -= 3
    			else:
    					e -= 1
    			k += i
    			if k >= len(c):
    					k -= len(c)
    			print(k, c[k], e)
    	print(k, c[k], e)
    	return e
    

    `