
DP
N.C_IPOC_BUPT
一个喜欢科怀.莱昂纳德的准程序猿,研一在读。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
96. Unique Binary Search Trees
题目描述方法思路这是一个动态规划问题;class Solution { //Runtime: 0 ms, faster than 100.00% //Memory Usage: 31.7 MB, less than 100.00% public int numTrees(int n) { if(n == 0 || n == 1) return 1;...原创 2019-03-21 12:17:48 · 149 阅读 · 0 评论 -
95. Unique Binary Search Trees II
题目描述方法思路class Solution{ //Runtime: 2 ms, faster than 68.65% //Memory Usage: 37.1 MB, less than 99.04% public List<TreeNode> generateTrees(int n) { if(n == 0) return new A...原创 2019-03-21 15:53:14 · 159 阅读 · 0 评论 -
213. House Robber II
题目描述题目链接https://leetcode.com/problems/house-robber-ii/方法思路class Solution { //Runtime: 0 ms, faster than 100.00% //Memory Usage: 35.5 MB, less than 94.44% public int rob(int[] nums) {...原创 2019-03-29 15:59:01 · 149 阅读 · 0 评论 -
337. House Robber III
题目描述The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the “root.” Besides the root, each house has one and only one parent house. After a...原创 2019-03-30 20:12:47 · 166 阅读 · 0 评论 -
198. House Robber 关于动态规划问题(Dynamic programming)的学习、思考与记录
动态规划(Dynamic programming)定义任何数学递推公式都可以直接转换为递归算法,但是基本现实是编译器常常不能正确对待递归算法,结果导致低效的程序。当怀疑出现这样的情况时,我们必须再给编译器提供一些帮助,即将递归算法转换为非递归算法,让后者把那些子问题的答案系统的记录在一个表内。利用这种方法的一种技巧叫做动态规划。以LeetCode.198. House Robber为例进行一...翻译 2019-03-28 22:37:15 · 217 阅读 · 0 评论