---
title: 'Jump Game | Greedy'
source: 'https://youtube.com/watch?v=iZnrKImzrlM'
video_id: 'iZnrKImzrlM'
date: 2026-08-04
duration_sec: 92
---

# Jump Game | Greedy

> Source: [Jump Game | Greedy](https://youtube.com/watch?v=iZnrKImzrlM)

## Summary

This video explains the Jump Game problem, a classic greedy algorithm challenge. The goal is to find the minimum number of jumps needed to reach the last cell, given that each cell has a maximum jump distance. The video contrasts a brute-force exponential approach with an efficient greedy solution that runs in O(N) time and O(1) space.

### Key Points

- **Problem Definition** [00:01] — The Jump Game is a greedy problem where each cell's value represents the maximum distance you can jump forward. The task is to find the minimum number of jumps to reach the last cell.
- **Brute Force Approach** [00:14] — The brute force method tries every possible path, branching from each cell to all reachable cells. This creates an exponentially expanding tree, which is too slow.
- **Greedy Strategy** [00:26] — Instead of exploring all paths, scan the current reachable range and pick the cell that reaches the farthest. That farthest point becomes the new range for the next jump. Count jumps until the range covers the last cell.
- **Example Walkthrough** [00:40] — Starting at index 0, the first jump can land up to index 2. Scanning indices 0-2, the cell at index 1 reaches index 4, so that's the best. After jump 2, the range is 1-4. The cell at index 4 reaches past the end, so jump 3 completes the goal. Total jumps: 3.
- **Complexity Analysis** [01:09] — The greedy solution is a single pass, O(N) time and O(1) space. No backtracking or dynamic programming is needed.

### Conclusion

The Jump Game can be solved efficiently with a greedy algorithm that scans the current range, picks the farthest reach, and extends it. This approach is optimal with O(N) time and O(1) space.

## Transcript

actually just a greedy problem. So, number is the maximum distance you can jump forward from that spot. Your job then is to find the minimum number of jumps needed to reach the last cell. The
brute force idea is to try every possible path. From the first cell, branch into every cell you can land on. From each of those, branch again. The tree of possible paths expands exponentially, which is of course just
way too slow. There's a much simpler greedy way. Think of it like this. After you could have landed on. Look across that whole range and find the single cell that lets you reach the farthest. That farthest spot becomes the new range
you can reach with one more jump. Keep counting jumps until your range covers an example. We can start on the first cell. With one jump, we land anywhere up to index two. So, index zero through two is our first range. Scan it. The cell at
index one carries us all the way to index four. That is the best reach in this range. Take jump two. Now, our new range stretches from index one to index four. Scan it again, and the cell at index four with value four shoots us
well past the end. Take jump three. Our range now covers the last cell. The goal is reached. Three jumps total. In each step, we just scan the current range, pick the farthest reach, and extend it. No backtracking, no DP required. It's
just one pass, O of N time, and O of one space. Try this and more problems with hellomaybe.com. Like, share, and subscribe.
