:type nums: List[int] :type target: int :rtype: int
(self, nums, target)
| 92 | |
| 93 | |
| 94 | def search(self, nums, target): |
| 95 | """ |
| 96 | :type nums: List[int] |
| 97 | :type target: int |
| 98 | :rtype: int |
| 99 | """ |
| 100 | if not nums: |
| 101 | return -1 |
| 102 | |
| 103 | rotate_index = self.find_rotate(nums) |
| 104 | |
| 105 | lo = 0 |
| 106 | hi = rotate_index |
| 107 | # print(hi) |
| 108 | one = self.bi_search(nums, target, lo, hi) |
| 109 | if one != -1: |
| 110 | return one |
| 111 | |
| 112 | two = self.bi_search(nums, target, hi, len(nums)) |
| 113 | if two != -1: |
| 114 | return two |
| 115 | return -1 |
nothing calls this directly
no test coverage detected