MCPcopy Create free account
hub / github.com/HuberTRoy/leetCode / find_rotate

Method find_rotate

Array/SearchInRotatedSortedArray.py:64–78  ·  view source on GitHub ↗
(self, nums)

Source from the content-addressed store, hash-verified

62"""
63class Solution(object):
64 def find_rotate(self, nums):
65 target = nums[0]
66
67 lo = 1
68
69 hi = len(nums)
70
71 while lo < hi:
72 mid = (lo + hi) // 2
73 if nums[mid] > target:
74 lo = mid + 1
75 else:
76 hi = mid
77
78 return lo
79
80 def bi_search(self, nums, target, lo, hi):
81 while lo < hi:

Callers 1

searchMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected