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 October 2026 (Oct 4–15)Sponsored by FLXBL
Contest runs October 4 - 15. Complete challenges to climb the leaderboard!
Prizes 1 & 2: Salesforce certification exam voucher — won by random drawing, where every point is a ticket. see all prizes
Only the 12 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.