3 Line C++ Clean and Short


  • 0
    F
    struct Solution {
        bool canJump(vector<int>& nums) {
            int i = 0, j = 0;
            for (;i <= j && j < (int)nums.size() - 1;j = max(j, nums[i] + i), ++ i);
            return j >= nums.size() - 1;
        }
    };
    

Log in to reply
 

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