#NEWLINE# def canJump( self , A ) : #NEWLINE# #INDENT# '\n        dp\n\n        dp[i] represents at index i from which the max index (absolute position) it can reach\n        dp[i] = max(dp[i-1], A[i]+i)\n        path not recorded, information loss, but sufficient for this question\n        scanning\n\n        O(N)\n        :param A: a list of integers\n        :return: a boolean\n        ' #NEWLINE# l = len ( A ) #NEWLINE# if ( l <= 1 ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# dp = [ ( - 1 ) for _ in xrange ( l ) ] #NEWLINE# dp [ 0 ] = ( A [ 0 ] + 0 ) #NEWLINE# for i in xrange ( 1 , l ) : #NEWLINE# #INDENT# if ( dp [ ( i - 1 ) ] >= ( l - 1 ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# if ( dp [ ( i - 1 ) ] < i ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# dp [ i ] = max ( dp [ ( i - 1 ) ] , ( A [ i ] + A ) ) #NEWLINE# #UNINDENT# return False