摘要:
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' 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
O(logN) Check four different situations: 1) The peek 2) increasing section 3) decreasing section 4) minimum 阅读全文
摘要:
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 阅读全文
摘要:
O(logN) 阅读全文
摘要:
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 阅读全文