Home
Log in
DescriptionSubmissionsSolution
DescriptionSubmissionsSolution
Loading...

Log in to run or submit

nums =

Codey

Practise coding problems, test your solutions and track your progress.

Explore

  • Problems
  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

© 2026 Codey. Personal learning project.

Solution
Updated: 2026-02-23

Idea

Greedy BFS-by-levels over reachable range.

Approach

Maintain current jump range [0..end] and the farthest reachable far within it. When index hits end, you must take a jump; set end = far.

Why it works

This mirrors BFS levels: each time you exhaust current range, you advance to next range with one more jump.

Code
Loading...
Complexity
Time: O(n)
Space: O(1)
Solution
Updated: 2026-02-23

Idea

Greedy BFS-by-levels over reachable range.

Approach

Maintain current jump range [0..end] and the farthest reachable far within it. When index hits end, you must take a jump; set end = far.

Why it works

This mirrors BFS levels: each time you exhaust current range, you advance to next range with one more jump.

Code
Loading...
Complexity
Time: O(n)
Space: O(1)