Dynamic programming (DP) is
- careful brute force
- divide to subproblems + reuse solution of these subproblems
- subporblems should not have cyclic dependencies
memoize - (remember) & re-use solutions to subproblems that help solve problem
idea of algorithm is start solving program from bottom and go up, may uses in junction with memoize
try all possible ways of solving subproblem and choose the best one.
- define subproblem (for recursion) = find exactly same computation
- guess (part of solution)
- topological sort of subproblem dependency DAG
- build algorithm memoize && (recursive || build DP table bottom-up)
- try to find ways to save space(memory)
- solve original problem