• + 0 comments
    def jumpingOnClouds(c):
        idx = 0
        jumps = 0
        while idx != len(c)-1:
            # Greedy, if can jump 2, then do it
            idx = idx+2 if idx+2 < len(c) and c[idx+2] == 0 else idx+1
            jumps += 1
        return jumps