Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
12 lines (11 loc) · 408 Bytes

File metadata and controls

12 lines (11 loc) · 408 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
package leetcode._55_;
class Solution { // 问题可以转化为找到可以跳到的最远的距离
public boolean canJump(int[] nums) {
int max = 0;
for (int i = 0; i < nums.length; i++) {
if (i > max) return false; // 如果最远距离到达不了当前索引,没有必要继续走了
max = Math.max(max, nums[i] + i);
}
return true;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.