2017年5月4日

摘要: The worst situation O(N). Actually we can either just loop through, or we can compare num[mid] with the num[end], if they are the same, that means it' 阅读全文
posted @ 2017-05-04 07:58 codingEskimo 阅读(82) 评论(0) 推荐(0) 编辑
摘要: O(logN) This question turns to find the first and last element of the target in a sorted array. Just be careful with the two result coming out of the 阅读全文
posted @ 2017-05-04 07:25 codingEskimo 阅读(88) 评论(0) 推荐(0) 编辑
摘要: O(N) if element can repeat, the worst case, you cannot throw away any section. eg. [1, 1, 1, 1, 0, 1, 1] target = 0, you cannot throw any section. We 阅读全文
posted @ 2017-05-04 07:11 codingEskimo 阅读(48) 评论(0) 推荐(0) 编辑
摘要: O(logN) Important Point: Once the target is in one section, use the point in that section as benchmark In this problem, if the target >= startVal, use 阅读全文
posted @ 2017-05-04 06:55 codingEskimo 阅读(100) 评论(0) 推荐(0) 编辑
摘要: O(logN) 阅读全文
posted @ 2017-05-04 06:21 codingEskimo 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 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) 编辑

导航