Both DP and greedy need optimal substructure. The difference: greedy also requires the greedy-choice property (a local optimum is globally optimal), while DP is needed when you must consider multiple choices and overlapping subproblems.
Mengapa ini penting
Optimal substructure? -- both need this
+ greedy-choice property holds? -> GREEDY (fast, one pass of choices)
+ must compare many sub-solutions / they overlap? -> DYNAMIC PROGRAMMING
