You are given a list of non-negative integers where each element represents the maximum jump length from that position. Starting at the first index, write a method that determines whether you can reach the last index.
Return false for null or empty input.
Examples
Input: nums = [2,3,1,1,4]
Output: true
Explanation: Jump 1 step to index 1, then jump 3 steps to the last index
Input: nums = [3,2,1,0,4]
Output: false
Explanation: No matter what path you take, you always reach index 3 with value 0 and cannot move forward
Input: nums = [0]
Output: true
Explanation: Already at the last index, no jump is needed
Input: nums = null
Output: false
Input: nums = [0,1,2]
Output: false
Explanation: The value at index 0 is 0, so you cannot move from the starting position
Apex Code Editor
Welcome to Lightning Challenge!
How It Works
- • Write your solution in the code editor
- • Connect your Salesforce org to test
- • Submit to check if your solution passes
- • Use hints if you get stuck
Contest Alert
🏆 #CodeEveryDay August 2026
Contest runs August 1 - 31. Complete challenges to climb the leaderboard!
Only the 31 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.