Jumping on the Clouds: Revisited

  • + 0 comments
    def jumpingOnClouds(c, k):
        e: int = 100
        n: int = len(c)
        idx: int = (0 + k) % n
        
        while True:
            e -= 1
            if c[idx] == 1:
                e -= 2
            if idx == 0:
                break
            idx = (idx + k) % n
        return e