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?
Use DP approach
Build solution step-by-step
End
Decide approach by checking if problem has optimal substructure and overlapping subproblems. Use DP if both exist, else greedy.
