Greedy
Starred by 25+ users, GitHub Repo: LeetCode Pattern 500 offers:
- 500 solutions for LeetCode problems in Python and Java
- 17 notes on essential concepts related to data structures and algorithms
- 130 patterns for solving LeetCode problems
greedy
intro
- greedy algorithms is to pick the locally optimal solution at each step with the hope of finding the global optimum
- dp vs greedy
- in dp, we solve overall problem by combining the solutions about subproblems
- in greedy, we make a series of localized optimal choices without considering the overall problem
pattern
- greedy
- we need to make the locally optimal choice
- sometimes, use sorting or heap can help us make greedy choice