For more details, please go through - Overlapping Subproblems Property in Dynamic Programming, Optimal Substructure Property in Dynamic Programming