Array Greedy Problems

Apply greedy thinking to arrays. Solve jump games, gas station, and other array-based problems.

41 lessons
99 min
Codeforces: 1100-1700LeetCode: 1400-1800

Lessons

1. Intro

Greedy on arrays

2m

2. Problem - Jump Game

Can you reach the end?

3m1 problems

3. Jump Game - The Idea

Track furthest reachable

3m

4. Jump Game - Walkthrough

Tracing the algorithm

3m

5. Jump Game - Implementation

The code

3m1 problems

6. Quiz: Jump Game

Apply the algorithm

1m1 problems

7. Problem - Jump Game II

Minimum jumps

3m1 problems

8. Jump Game II - Algorithm

BFS-like levels

4m

9. Jump Game II - Implementation

The code

3m1 problems

10. Problem - Gas Station

Circular route

3m1 problems

11. Gas Station - The Idea

Find the valley

3m

12. Gas Station - Implementation

The code

3m1 problems

13. Quiz: Gas Station

Apply the insight

1m1 problems

14. Problem - Boats to Save People

Pair heavy with light

3m1 problems

15. Boats - Algorithm

Two-pointer pairing

3m

16. Boats - Implementation

The code

3m1 problems

17. Problem - Candy

Distribute fairly

3m1 problems

18. Candy - Algorithm

Two-pass greedy

4m

19. Candy - Implementation

The code

3m1 problems

20. Quiz: Two-Pass Pattern

When to use it

1m1 problems

21. Problem - Maximum Subarray

Kadane's algorithm

3m1 problems

22. Kadane's Algorithm

Reset when negative

3m

23. Kadane's - Implementation

The code

3m1 problems

24. Kadane's - Why It Works

The greedy insight

2m

25. Quiz: Kadane's Algorithm

Understanding the reset

1m1 problems

26. Problem - Best Time to Buy and Sell Stock

One transaction

2m1 problems

27. Stock - The Idea

Track the minimum

2m

28. Stock - Implementation

The code

2m1 problems

29. Problem - Best Time to Buy and Sell Stock II

Unlimited transactions

2m1 problems

30. Stock II - Greedy Insight

Collect all gains

2m

31. Stock II - Implementation

The code

2m1 problems

32. Quiz: Stock Trading

Comparing strategies

1m1 problems

33. Problem - Partition Labels

Maximum partitions

2m1 problems

34. Partition Labels - Algorithm

Extend to last occurrence

2m

35. Partition Labels - Implementation

The code

3m1 problems

36. Problem - Queue Reconstruction by Height

People in line

2m1 problems

37. Queue Reconstruction - Greedy Insight

Tallest first

2m

38. Queue Reconstruction - Implementation

The code

3m1 problems

39. Quiz: Greedy Ordering

Why tallest first

1m1 problems

40. What is Next

Looking ahead

2m

41. Section Recap

What we learned

2m

Practice Problems

Ready to start learning?

Access all 41 lessons with interactive content and progress tracking.