A high quality DP problem to work on. It is not an merely educational DP, it is subtle.Basic ideas: 1. Run original DP twice, 1st with num[0] selecte....
分类:
其他好文 时间:
2015-05-20 13:09:06
阅读次数:
115
动态规划问题,只需要保证当前获得的就是最大的值就可以了...
分类:
其他好文 时间:
2015-05-15 10:49:34
阅读次数:
147
题目描述:
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adj...
分类:
其他好文 时间:
2015-05-14 16:34:46
阅读次数:
115
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo...
分类:
其他好文 时间:
2015-05-13 08:45:52
阅读次数:
116
题意:有一个整数序列,从中挑出一些数字,使得总和是最大,前提是,相邻的两个数字中只能挑其一。比如1 2 3 就只能挑2或者1和3。思路:很直观的题,dp思想。降低规模,从小规模开始考虑。如果只有两个数字,那么结果很明显就能知道是其中之大者。假如已经知道了第 i 个之前的决策,那么第i+2个之前的决策...
分类:
其他好文 时间:
2015-05-12 18:24:59
阅读次数:
115
题目:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping...
分类:
其他好文 时间:
2015-05-07 14:11:44
阅读次数:
89
抢劫一排沿街的房子,每一家有不同的财富值,一夜之内抢了连续两家就会拉响报警。给出每家的财富值,求最多能抢到多少?【思路】动态规划求最优解。解题关键:递推式——maxV[i]=max{maxV[i-2]+nums[i], maxV[i-1]};【other code】int rob(vector& n...
分类:
其他好文 时间:
2015-05-04 10:00:19
阅读次数:
98
今天看了一个华为西安研究院的一个女生代码大神的总结很有感悟,下面这句话送给大家:只有好的程序员才能写出人类可以理解的代码You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint st...
分类:
其他好文 时间:
2015-04-30 18:19:46
阅读次数:
122
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses...
分类:
其他好文 时间:
2015-04-30 12:33:59
阅读次数:
152
leetcode -house-robberhttps://leetcode.com/problems/house-robber/Q:You are a professional robber planning to rob houses along a street. Each house has...
分类:
其他好文 时间:
2015-04-29 23:19:17
阅读次数:
148