[leetcode刷题系列]Jump Game

 也许算是dp把- - 


class Solution {
public:
    bool canJump(int A[], int n) {
        // Start typing your C/C++ solution below
        // DO NOT write int main() function
        int last = n - 1;
        for(int i = n - 2; i >= 0; -- i){
            if(i + A[i] >= last )
                last = i;
        }
        return last == 0;
    }
};


你可能感兴趣的:([leetcode刷题系列]Jump Game)