After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all houses at this place are arranged in a ci...
分类:
其他好文 时间:
2015-06-17 09:44:34
阅读次数:
162
解题思路:
思路一:A[i][0]表示第i次没有抢劫,A[i][1]表示第i次进行了抢劫,即A[i+1][0] = max(A[i][0], A[i][1]).. 那么rob当前的house,只能等
于上次没有rob的+money[i+1], 则A[i+1][1] = A[i][0]+money[i+1].实际上只需要两个变量保存结果就可以了,不需要用二维数组
思路二:找到递推关系:maxV[i] = max(maxV[i-2]+num[i], maxV[i-1])...
分类:
编程语言 时间:
2015-06-16 16:47:08
阅读次数:
207
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-06-14 12:32:38
阅读次数:
118
Note: This is an extension of House Robber.
After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time...
分类:
其他好文 时间:
2015-06-13 12:54:22
阅读次数:
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 house...
分类:
其他好文 时间:
2015-06-13 09:49:50
阅读次数:
98
Note: This is an extension of House Robber.After robbing those houses on that street, the thief has found himself a new place for his thievery so that...
分类:
编程语言 时间:
2015-06-09 21:27:40
阅读次数:
197
House Robber题目链接 House Robber II题目链接 1.House Robber 题目要求: You are a professional robber planning to rob houses along a street. Each house has a ...
分类:
其他好文 时间:
2015-06-09 16:35:53
阅读次数:
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 yo...
分类:
编程语言 时间:
2015-06-07 10:54:26
阅读次数:
227
This problem is a little tricky at first glance. However, if you have finished the "House Robber" problem, this problem can simply bedecomposed into t...
分类:
其他好文 时间:
2015-06-03 00:42:11
阅读次数:
231
Note: This is an extension of House Robber.After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all...
分类:
其他好文 时间:
2015-05-30 21:15:01
阅读次数:
152