# -*- coding: utf-8 -*-
# @Time    : 2019-08-31 15:47
# @Author  : Zhangjialuo
# @mail    : zhang_jia_luo@foxmail.com
# @File    : canJump.py
# @Software: PyCharm


class Solution(object):
    def canJump(self, nums):
        """
        :type nums: List[int]
        :rtype: bool
        """
        if not nums:
            return False

        left_index = len(nums) - 1
        for i in range(len(nums)-1, -1, -1):
            if i + nums[i] >= left_index:
                left_index = i

        return left_index == 0


if __name__ == '__main__':
    print(Solution().canJump([3,2,1,0,4]))


14690b9806e526561ec8502db561a114b33bd92f
<mask token>

class Solution(object):
    <mask token>


<mask token>

class Solution(object):

    def canJump(self, nums):
        """
        :type nums: List[int]
        :rtype: bool
        """
        if not nums:
            return False
        left_index = len(nums) - 1
        for i in range(len(nums) - 1, -1, -1):
            if i + nums[i] >= left_index:
                left_index = i
        return left_index == 0


<mask token>

class Solution(object):

    def canJump(self, nums):
        """
        :type nums: List[int]
        :rtype: bool
        """
        if not nums:
            return False
        left_index = len(nums) - 1
        for i in range(len(nums) - 1, -1, -1):
            if i + nums[i] >= left_index:
                left_index = i
        return left_index == 0


if __name__ == '__main__':
    print(Solution().canJump([3, 2, 1, 0, 4]))

# -*- coding: utf-8 -*-
# @Time    : 2019-08-31 15:47
# @Author  : Zhangjialuo
# @mail    : zhang_jia_luo@foxmail.com
# @File    : canJump.py
# @Software: PyCharm


class Solution(object):
    def canJump(self, nums):
        """
        :type nums: List[int]
        :rtype: bool
        """
        if not nums:
            return False

        left_index = len(nums) - 1
        for i in range(len(nums)-1, -1, -1):
            if i + nums[i] >= left_index:
                left_index = i

        return left_index == 0


if __name__ == '__main__':
    print(Solution().canJump([3,2,1,0,4]))

