class Solution { public: bool canJump(vector& nums) { int cover = 0; for(int i = 0; i <= cover; ++i) { cover = max(cover, nums[i] + i); if(cover >= nums.size() - 1) { return true; } } return false; } };
欢迎分享,转载请注明来源:内存溢出
class Solution { public: bool canJump(vector& nums) { int cover = 0; for(int i = 0; i <= cover; ++i) { cover = max(cover, nums[i] + i); if(cover >= nums.size() - 1) { return true; } } return false; } };
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)