
解题思路:
class Solution {
public boolean canJump(int[] nums) {
int n = nums.length;
int maxReach = 0;
// 正常来说每次至少跳一格,所以最多循环n次
for (int i = 0; i < n; i++) {
if (i > maxReach) return false;// 这种情况代表遇到了0,跳不动了
if (maxReach >= n - 1) return true;
maxReach = Math.max(maxReach, i + nums[i]);
}
return false;
}
}








![[通用人工智能] 论文分享:ElasticViT:基于冲突感知超网的快速视觉Transformer](https://img-blog.csdnimg.cn/direct/cd26178d936e468fa0002af1e1809778.png)










