摘要: public class Solution { public int[] searchRange(int[] A, int target) { int[] res = {-1, -1}; if(A==null || A.length<1) return res; ... 阅读全文
posted @ 2015-04-14 05:35 世界到处都是小星星 阅读(139) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int search(int[] A, int target) { if(A==null || A.length==0) return -1; int l = 0; i... 阅读全文
posted @ 2015-04-13 09:10 世界到处都是小星星 阅读(127) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int removeElement(int[] A, int elem) { if(A==null||A.length<1) return 0; // same http://www.cnblogs.co... 阅读全文
posted @ 2015-04-10 13:18 世界到处都是小星星 阅读(114) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int removeDuplicates(int[] A) { if(A==null || A.length==0) return 0; // 巧妙的做法http://www.cnblogs.com/sp... 阅读全文
posted @ 2015-04-10 12:59 世界到处都是小星星 阅读(76) 评论(0) 推荐(0) 编辑
摘要: public int maxArea(int[] height) { //http://blog.csdn.net/linhuanmars/article/details/21145429 贪心算法要看看 if(height==null || height.len... 阅读全文
posted @ 2015-04-10 12:22 世界到处都是小星星 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 感觉和Container With Most Water很像,这里有个问题,如果让球最大的坑,怎么做呢?还有candy那道题,好像都是这种双扫系列的refhttp://fisherlei.blogspot.com/2013/01/leetcode-trapping-rain-water.html双扫... 阅读全文
posted @ 2015-04-10 11:32 世界到处都是小星星 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 答案部分完全借鉴http://www.cnblogs.com/springfor/p/3861890.html以下是摘抄:“爱做饭的小莹子”题目:There are two sorted arrays A and B of size m and n respectively. Find the me... 阅读全文
posted @ 2015-04-10 10:23 世界到处都是小星星 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 很简单一道题,就是细节容易出错,必然是二分才有nlogn的速度public class Solution { public ListNode sortList(ListNode head) { // 跟merge sort 一模一样 http://www.cnblogs.com/... 阅读全文
posted @ 2015-04-10 06:23 世界到处都是小星星 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 原题解法超屌: ref http://blog.csdn.net/u012162613/article/details/41560337 public ListNode getIntersectionNode(ListNode headA, ListNode headB) { if(... 阅读全文
posted @ 2015-04-10 04:17 世界到处都是小星星 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 容易出错的点1 不是原位排序,惊讶!!2 要重新定位pre!!public class Solution { public ListNode insertionSortList(ListNode head) { // 想清楚怎么插入就很简单啦 if(head==nu... 阅读全文
posted @ 2015-04-09 13:06 世界到处都是小星星 阅读(95) 评论(0) 推荐(0) 编辑