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
Get final answer
Decide approach by checking if problem has optimal substructure and overlapping subproblems; use DP if both, else greedy.
