• + 0 comments

    Solution of Jumping on the Clouds

    def jumpingOnClouds(c):
        jump=0
        i=0
        while(i< len(c)-2):
            
            if(c[i+2] != 0):
                jump+=1
                i+=1
                
            elif(c[i+2] == 0):
                jump+=1
                i+=2
    
        if(i == len(c)-1):
            return jump
        
        else:
            return jump+1