Concept Flow - Greedy vs DP How to Know Which to Apply
Start Problem
Check if problem has optimal substructure?
Yes
Check if problem has overlapping subproblems?
Yes No
Use DP
Build solution using stored results
Solution
Start by checking if the problem has optimal substructure. Then check if subproblems overlap. Use DP if yes, else greedy.
