| 1 | // Jump Game - LeetCode #55 |
| 2 | |
| 3 | class Solution { |
| 4 | public boolean canJump(int[] nums) { |
| 5 | int maxReach = 0; |
| 6 | |
| 7 | for (int i = 0; i < nums.length; i++) { |
| 8 | if (i > maxReach) return false; |
| 9 | maxReach = Math.max(maxReach, i + nums[i]); |
| 10 | if (maxReach >= nums.length - 1) return true; |
| 11 | } |
| 12 | |
| 13 | return true; |
| 14 | } |
| 15 | } |
nothing calls this directly
no outgoing calls
no test coverage detected