小偷第三题 list的add(index,val)方法相当于插入,要修改某个地方用set,这和map的put不一样,map的put之后就直接覆盖了。 ...
分类:
其他好文 时间:
2018-01-28 21:53:34
阅读次数:
148
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 ...
分类:
其他好文 时间:
2018-01-21 11:07:10
阅读次数:
127
#week7 You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stop ...
分类:
其他好文 时间:
2018-01-13 11:18:10
阅读次数:
190
198. House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only cons ...
分类:
编程语言 时间:
2018-01-08 22:30:02
阅读次数:
200
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 hou ...
分类:
其他好文 时间:
2017-12-07 22:42:47
阅读次数:
245
题目的意思很简单,就是每次只能取非连续的两个值 用分治法在nums比较大时会超时 仔细思考一下发现有重复子问题,设v中存着最优的解,则最优解为 max(v[n][0],v[n][1]),v[n][0]表示不取第n个数时的最优解,v[n][1]表示取第n个数时的最优解,同时满足最优子结构性质,如下所示 ...
分类:
其他好文 时间:
2017-11-30 19:22:24
阅读次数:
143
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 ...
分类:
其他好文 时间:
2017-10-18 18:27:15
阅读次数:
121
The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because they become t ...
分类:
其他好文 时间:
2017-08-21 00:06:57
阅读次数:
233
这道题是之前那道House Robber 打家劫舍的拓展,现在房子排成了一个圆圈,则如果抢了第一家,就不能抢最后一家,因为首尾相连了,所以第一家和最后一家只能抢其中的一家,或者都不抢,那我们这里变通一下,如果我们把第一家和最后一家分别去掉,各算一遍能抢的最大值,然后比较两个值取其中较大的一个即为所求 ...
分类:
其他好文 时间:
2017-08-04 13:52:38
阅读次数:
116