Greedy
Problems using greedy algorithms
40 lessons
110 min
Lessons
1. What is Greedy
Pattern overview
2m
2. Prerequisites
What you need first
1m
3. When to Use
Pattern triggers
2m
4. When NOT to Use
Avoid forcing this pattern
2m
5. LeetCode 455 Assign Cookies - Problem Statement
The problem
3m1 problems
6. LeetCode 455 Assign Cookies - Solution
The pattern
4m
7. LeetCode 455 Assign Cookies - Example and Complexity Analysis
Walkthrough and analysis
3m
8. LeetCode 455 Assign Cookies - Implementation
The code
4m1 problems
9. LeetCode 53 Maximum Subarray - Problem Statement
The problem
2m1 problems
10. Quiz: Kadane's Decision
Test your understanding
2m1 problems
11. LeetCode 53 Maximum Subarray - Solution
The core idea
3m
12. LeetCode 53 Maximum Subarray - Example and Complexity Analysis
Walkthrough and analysis
3m
13. LeetCode 53 Maximum Subarray - Implementation
The approach
4m1 problems
14. LeetCode 134 Gas Station - Problem Statement
The problem
2m1 problems
15. Quiz: Gas Station Starting Point
Test your understanding
2m1 problems
16. LeetCode 134 Gas Station - Why Naive Fails
The trap
2m
17. LeetCode 134 Gas Station - Solution
The core idea
3m
18. LeetCode 134 Gas Station - Example and Complexity Analysis
Walkthrough and analysis
3m
19. LeetCode 134 Gas Station - Implementation
The approach
4m1 problems
20. LeetCode 763 Partition Labels - Problem Statement
The problem
2m1 problems
21. LeetCode 763 Partition Labels - Why Naive Fails
The trap
2m
22. LeetCode 763 Partition Labels - Solution
The core idea
3m
23. LeetCode 763 Partition Labels - Example and Complexity Analysis
Walkthrough and analysis
3m
24. LeetCode 763 Partition Labels - Implementation
The approach
4m1 problems
25. LeetCode 45 Jump Game II - Problem Statement
The problem
2m1 problems
26. LeetCode 45 Jump Game II - Why Naive Fails
The trap
2m
27. LeetCode 45 Jump Game II - Solution
The core idea
3m
28. LeetCode 45 Jump Game II - Example and Complexity Analysis
Walkthrough and analysis
3m
29. LeetCode 45 Jump Game II - Implementation
The approach
4m1 problems
30. LeetCode 55 Jump Game - Problem Statement
The problem
2m1 problems
31. LeetCode 55 Jump Game - Why Naive Fails
The trap
2m
32. LeetCode 55 Jump Game - Solution
The core idea
3m
33. LeetCode 55 Jump Game - Example and Complexity Analysis
Walkthrough and analysis
3m
34. LeetCode 55 Jump Game - Implementation
The approach
4m1 problems
35. LeetCode 135 Candy - Problem Statement
The problem
3m1 problems
36. LeetCode 135 Candy - Solution
The pattern
4m
37. LeetCode 135 Candy - Example and Complexity Analysis
Walkthrough and analysis
3m
38. LeetCode 135 Candy - Implementation
The code
4m1 problems
39. Common Mistakes
Common errors to avoid
2m
40. Section Recap
Summary
1m
Practice Problems
1.
2.
3.
4.
5.
7.
8.
10.
11.
12.
13.
14.
15.