Sort by

recency

|

3259 Discussions

|

  • + 0 comments

    python3

    def jumpingOnClouds(c):
        # Write your code here
        
        counter = 0
        i = 0
        
        while i + 2 <= len(c) - 1:
            counter += 1
            if c[i + 2] == 0:
                i += 2
            else:
                i += 1
        
        if i == len(c) - 2:
            return counter + 1
        else:
            return counter
    
  • + 0 comments

    Here is my Python solution!

    def jumpingOnClouds(c):
        steps = 0
        index = 0
        while index != len(c) - 1:
            if len(c) - index <= 2:
                return steps + 1
            if c[index + 2] == 1:
                index += 1
            else:
                index += 2
            steps += 1
        return steps
    
  • + 0 comments

    Hi this is my solution :) def jumpingOnClouds(c): # Write your code here index = 0 jumps = 1

    while index < len(c) - 3: if c[index + 2] == 0: index = index + 2 jumps = jumps + 1 else: index = index + 1 jumps = jumps + 1 return jumps

    if name == 'main': fptr = open(os.environ['OUTPUT_PATH'], 'w')

    n = int(input().strip())
    
    c = list(map(int, input().rstrip().split()))
    
    result = jumpingOnClouds(c)
    
    fptr.write(str(result) + '\n')
    
    fptr.close()
    
  • + 0 comments

    def jumpingOnClouds(c):

    n = len(c)
    i = 0
    jump = 0
    
    if n == 2:
        return 1
    
    while i < n-2:
    
    
        if c[i+2] == 0:
            i = i+2
            jump += 1
    
    
        else:
            i = i+1
            jump += 1
    
    
    
    if c[-2] == 0 and c[-3] !=0:
        return jump + 1
    else:
        return jump
    
  • + 0 comments

    Jumping on the Clouds sounds like such a fun and creative concept! Whether it's about tackling challenges or dreaming big, it's a reminder to aim high. Just like in life, though, it’s always smart to pair those big dreams with a little financial due diligence to keep things grounded. What’s the story behind this idea?