"Starting from 0 to make LeetCode" advanced from violent recursion to dynamic programming
1. Number of ways to exchange money
Violent recursion:
Always let you calculate the repeated state multiple times
No aftereffects
Queen N-there is a problem of aftereffect-basically not tested
Brute force method optimization: take a map record
Memory search:
Change to dynamic programming:
Optimization of space
2. Solitaire game problem in a line
Violent recursion
Dynamic programming, two tables
3. Walking problems
Change dynamic programming:
a bit similar to Yanghui triangle.
Find the value of M and P step: the
variables are also K and P, according to which the initial value can be determined