dynamic programming

dynamic programming (also known as dynamic optimization) is a method for solving a complex problem by breaking it down into a collection of simpler subproblems, solving each of those subproblems just once, and storing their solutions – ideally, using a memory-based data structure. The next time the same subproblem occurs, instead of recomputing its solution, one simply looks up the previously computed solution, thereby saving computation time at the expense of a (hopefully) modest expenditure in storage space.

The definition show us how to deal with the dynamic programming problem step by step, but why can’t i solve them easily? LOL

bottom-up dynamic programming algorithm:

1.start from the very beginning
2.use loop instead of recursive