Please help


  • 0
    S

    I 'm not sure what's wrong with this code.

    jumps = [sys.maxint] * len(nums)
            
            jumps[0] = min(0, nums[0])
            
            for index, count in enumerate(nums[1:]):
                for prev in xrange(index):
                    if nums[prev] + prev >= index:
                        jumps[index] = min(jumps[index], jumps[prev] + 1)
            
            return jumps[-1]
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.