2017年5月4日

摘要: O(logN) Check four different situations: 1) The peek 2) increasing section 3) decreasing section 4) minimum 阅读全文
posted @ 2017-05-04 06:16 codingEskimo 阅读(76) 评论(0) 推荐(0) 编辑
摘要: O(logN) There are two section: 1) increase array which the first element is larger than end one. 2) the minimum to end Comparing with the endVal, 1) i 阅读全文
posted @ 2017-05-04 06:06 codingEskimo 阅读(84) 评论(0) 推荐(0) 编辑
摘要: O(logN) 阅读全文
posted @ 2017-05-04 05:45 codingEskimo 阅读(87) 评论(0) 推荐(0) 编辑
摘要: O(logN) Important Point: if there "mid" exists, it has at laest three elements in "nums", because otherwise it will not come inside the loop. So later 阅读全文
posted @ 2017-05-04 05:28 codingEskimo 阅读(93) 评论(0) 推荐(0) 编辑

2017年5月2日

摘要: class Solution { /** * @param x: An integer * @return: The sqrt of x */ public int sqrt(int x) { // write your code here if (x < 0) { return -1; ... 阅读全文
posted @ 2017-05-02 09:40 codingEskimo 阅读(82) 评论(0) 推荐(0) 编辑
摘要: If it is two eggs: http://datagenetics.com/blog/july22012/index.html Imagine we drop our first egg from floor n, if it breaks, we can step through the 阅读全文
posted @ 2017-05-02 09:02 codingEskimo 阅读(334) 评论(0) 推荐(0) 编辑
摘要: public class Solution { /** * @param A an integer array sorted in ascending order * @param target an integer * @return an integer */ public int totalOccurrence(int[] A, in... 阅读全文
posted @ 2017-05-02 07:57 codingEskimo 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Method One: Using Binary Search Once. The point is how to calculated the number's index. mtarix[<num> / nCol][<num> % nCol] Method Two:Binary Search T 阅读全文
posted @ 2017-05-02 07:44 codingEskimo 阅读(107) 评论(0) 推荐(0) 编辑
摘要: O(logN) 阅读全文
posted @ 2017-05-02 06:46 codingEskimo 阅读(108) 评论(0) 推荐(0) 编辑
摘要: O(logN)For the last element, if nums[mid] == target, we threw the first part 阅读全文
posted @ 2017-05-02 06:42 codingEskimo 阅读(151) 评论(0) 推荐(0) 编辑

导航