Jumping on the Clouds: Revisited

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