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) 编辑
摘要: O(logN) 阅读全文
posted @ 2017-05-02 06:31 codingEskimo 阅读(137) 评论(0) 推荐(0) 编辑
摘要: Important point: 1) While (start + 1 < end) 2) int mid = start + (end - start)/2;3) check both nums[start] and nums[end] at the end 阅读全文
posted @ 2017-05-02 06:16 codingEskimo 阅读(100) 评论(0) 推荐(0) 编辑

导航