My O(n) time complexity O(1) space complexity solution


  • 3
    C
    public class Solution {
    public boolean canJump(int[] A) {
        int end=0;
        
        for(int i=0;i<=end;i++){
            end = Math.max(end,A[i]+i);
            if(end>=A.length-1)
                return true;
        }
        return false;        
    }
    

    }


Log in to reply
 

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