上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 22 下一页
摘要: 经典问题,可以把周边都做了,详见ref http://blog.csdn.net/linhuanmars/article/details/19949159public class Solution { public int lengthOfLongestSubstring(String s) ... 阅读全文
posted @ 2015-04-20 12:21 世界到处都是小星星 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 题目看不到,所以网上搜刮http://www.danielbit.com/blog/puzzle/leetcode/leetcode-missing-ranges学习了一下public class Solution { public List findMissingRanges(int[] v... 阅读全文
posted @ 2015-04-20 07:23 世界到处都是小星星 阅读(126) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public void rotate(int[] nums, int k) { if(nums==null||nums.length<2||k<1) return; int n = nums.length; ... 阅读全文
posted @ 2015-04-20 05:33 世界到处都是小星星 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 很有趣的一个算法,不过好像除此之外用处不大ref http://www.geeksforgeeks.org/majority-element/public int majorityElement(int[] num) { if(num.length<3) return num[0]; ... 阅读全文
posted @ 2015-04-19 13:12 世界到处都是小星星 阅读(137) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int findPeakElement(int[] num) { // binary search http://siddontang.gitbooks.io/leetcode-solution/content/arr... 阅读全文
posted @ 2015-04-19 13:01 世界到处都是小星星 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 之前一步一步存的方法略复杂啊,其实直接二分扔就可以咯这里直接给个II的解法,和I多个冗余挪位的判断public class Solution { public int findMin(int[] nums) { int min = nums[0]; int l=0,... 阅读全文
posted @ 2015-04-19 12:42 世界到处都是小星星 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 总结帖http://blog.csdn.net/linhuanmars/article/details/39366817code 参考帖http://www.cnblogs.com/springfor/p/3869981.htmlhttp://blog.csdn.net/linhuanmars/ar... 阅读全文
posted @ 2015-04-19 11:46 世界到处都是小星星 阅读(121) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int maxProfit(List prices) { // http://blog.csdn.net/linhuanmars/article/details/23236995 if(prices==n... 阅读全文
posted @ 2015-04-18 12:42 世界到处都是小星星 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 这几道题最好连着做, 模式就是loc 和global比,难点在于求出loc,咦,我做过这个梦吔I 只能交易一次,那么loc就和0比 loc = max(loc+diff, 0)为啥是loc+当天diff呢?比如 1,2,4, 1买进,2-1的差价在loc里存着,到了4 的时候4和1 的差价=4-2 ... 阅读全文
posted @ 2015-04-18 11:52 世界到处都是小星星 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 还是细节容易错画个图11 21 2 31 2 3 4很容易就出来了额public class Solution { public int minimumTotal(List> triangle) { int m = triangle.size() ; if(m==1... 阅读全文
posted @ 2015-04-18 11:24 世界到处都是小星星 阅读(140) 评论(0) 推荐(0) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 22 下一页