question: public boolean canJump ( int [ ] A ) { if ( A == null || A . length == 0 ) return false ; if ( A . length == 1 ) return true ; if ( A [ 0 ] == 0 ) return false ; int maxJump = A [ 0 ] ; for ( int i = 1 ; i < A . length - 1 ; i ++ ) { maxJump = Math . max ( maxJump - 1 , A [ i ] ) ; if ( maxJump == 0 ) return false ; } return true ; }
target:  Dynamic Programming Keep track of the maximum of jumps we left Initialized as A[0] Traverse from second to second last Reduce 1 every time we jump maxJump should be max of maxJump - 1 and A[i] if maxJump reduces to zero, we are not able to reach anymore