https://discuss.leetcode.com/topic/39834/step-by-step-tackling-of-the-problem rob(root) which will return the maximum amount of money that we can rob ...
分类:
其他好文 时间:
2016-11-23 12:41:31
阅读次数:
237
题意:将一个n(1 <= n <= 100)个元素的序列排成非递减序列,每次操作可以指定区间[ L,R ](区间内元素个数为偶数),将区间内第一项与第二项交换,第三项与第四项交换,第五项与第六项……在2W次内完成排序,输出每次操作。 瞎搞即可,不断检查相邻元素是否满足 前者>=后者,不满足即交换,直 ...
分类:
其他好文 时间:
2016-10-25 13:43:25
阅读次数:
198
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 ...
分类:
其他好文 时间:
2016-10-22 12:21:41
阅读次数:
186
一、题目 House Robber(一道Leetcode上的关于动态规划的简单题目)具体描述如下: There is a professional robber planning to rob houses along a street. Each house has a certain amoun ...
分类:
其他好文 时间:
2016-10-04 16:33:40
阅读次数:
211
暴力搜索: public class Solution { public int search(int idx, int[] nums){ if(idx<0){ return 0; } return Math.max(nums[idx] + search(idx-2, nums), search(i ...
分类:
其他好文 时间:
2016-09-24 17:25:12
阅读次数:
148
先附上题目链接,有两问: https://leetcode.com/problems/house-robber/ https://leetcode.com/problems/house-robber-ii/ 第一问题目如下: You are a professional robber plannin ...
分类:
其他好文 时间:
2016-09-24 13:29:36
阅读次数:
183
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 ...
分类:
其他好文 时间:
2016-09-15 13:42:14
阅读次数:
136
输入一个数组,a[i]表示第i位置的房子的价值,这些房子围成一个圈,相邻的两个房子不能同时抢,问能抢到的最大的价值 和这些题是一个系列http://blog.csdn.net/ac_0_summer/article/details/52348192 这里围成一个圈,那么对最后一个房子来说: 1.如果 ...
分类:
其他好文 时间:
2016-09-01 14:47:23
阅读次数:
218
198.HouseRobberYouareaprofessionalrobberplanningtorobhousesalongastreet.Eachhousehasacertainamountofmoneystashed,theonlyconstraintstoppingyoufromrobbingeachofthemisthatadjacenthouseshavesecuritysystemconnectedanditwillautomaticallycontactthepoliceiftwoadjac..
分类:
其他好文 时间:
2016-09-01 00:27:50
阅读次数:
138
213.HouseRobberIINote:ThisisanextensionofHouseRobber.Afterrobbingthosehousesonthatstreet,thethiefhasfoundhimselfanewplaceforhisthieverysothathewillnotgettoomuchattention.Thistime,allhousesatthisplacearearrangedinacircle.Thatmeansthefirsthouseistheneighborof..
分类:
其他好文 时间:
2016-09-01 00:19:52
阅读次数:
167