← Back

Dynamic Programming 动态规划


hallmark 1

“An optimal solution to a problem contains optimal solutions to subproblems.” 一个问题的最优解, 包含其子问题的最优解.

hallmark 2

“A recursive solution contains a ‘small’ number of distinct subproblems repeated many times.” 一个递归解含有少量不同子问题, 且子问题重复出现多次

Method 1

自顶向下 状态缓存

Method 2

自底向上 递归求解