public class Solution {
public boolean canJump(int[] nums) {
int max_move = 0;
for(int i = 0; i < nums.length; i++){
if(i > max_move){
return false;
}
max_move = Math.max(max_move,nums[i] + i);
}
return true;
} }
Java Answer for Jump Game

For this answer, trying to iterate all array items one time. And in every time check whether the max jump position is smaller than the index itself.
If the position of item is smaller than max jump position, that means it can arrive at this position, and then you can update the new Max_move(max jump position).
If not, it means this you can not arrive at this position, so just return false, due to it is impossible to reach the last index .