55. Jump Game
Approach calculate the maxIndex possible from every point if index is maximum from maxIndex than return false else return true at end Complexity Time complexity: O(n) Space complexity: O(n) Code Java class Solution { public boolean canJump ( int [ ] nums ) { int maxIndex = 0 ; for ( int i = 0 ; i < nums . length ; i ++ ) { if ( maxIndex < i ) { return false ; } else { maxIndex = Math . max ( maxIndex , i + nums [ i ] ) ; } } return true ; } }