> For the complete documentation index, see [llms.txt](https://chiragjain.gitbook.io/neetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chiragjain.gitbook.io/neetcode/45-jump-game-ii/code.md).

# CODE

```python
class Solution:
    def jump(self, nums: List[int]) -> int:  
        # from the current element in the window find the
        # farthest index that you can jump. That becomes
        # the end point of the next window
        # Number of windows is the result
        l, r = 0, 0
        res = 0
        while r < (len(nums) - 1):
            maxJump = 0
            for i in range(l, r + 1):
                maxJump = max(maxJump, i + nums[i])
            l = r + 1
            r = maxJump
            res += 1
        return res
        
```
