摘要:
public class Solution { public int[] searchRange(int[] A, int target) { int[] res = {-1, -1}; if(A==null || A.length<1) return res; ... 阅读全文
摘要:
public class Solution { public int search(int[] A, int target) { if(A==null || A.length==0) return -1; int l = 0; i... 阅读全文
摘要:
public class Solution { public int removeElement(int[] A, int elem) { if(A==null||A.length<1) return 0; // same http://www.cnblogs.co... 阅读全文
摘要:
public class Solution { public int removeDuplicates(int[] A) { if(A==null || A.length==0) return 0; // 巧妙的做法http://www.cnblogs.com/sp... 阅读全文
摘要:
public int maxArea(int[] height) { //http://blog.csdn.net/linhuanmars/article/details/21145429 贪心算法要看看 if(height==null || height.len... 阅读全文
摘要:
感觉和Container With Most Water很像,这里有个问题,如果让球最大的坑,怎么做呢?还有candy那道题,好像都是这种双扫系列的refhttp://fisherlei.blogspot.com/2013/01/leetcode-trapping-rain-water.html双扫... 阅读全文
摘要:
答案部分完全借鉴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... 阅读全文
摘要:
很简单一道题,就是细节容易出错,必然是二分才有nlogn的速度public class Solution { public ListNode sortList(ListNode head) { // 跟merge sort 一模一样 http://www.cnblogs.com/... 阅读全文
摘要:
原题解法超屌: ref http://blog.csdn.net/u012162613/article/details/41560337 public ListNode getIntersectionNode(ListNode headA, ListNode headB) { if(... 阅读全文
摘要:
容易出错的点1 不是原位排序,惊讶!!2 要重新定位pre!!public class Solution { public ListNode insertionSortList(ListNode head) { // 想清楚怎么插入就很简单啦 if(head==nu... 阅读全文