<doocs>0033.Search in Rotated Sorted Array_1.py
def search( nums: List[int], target: int) -> int:
    n = len(nums)
    left, right = 0, n - 1
    while left < right:
        mid = (left + right) >> 1
        if nums[0] <= nums[mid]:
            if nums[0] <= target <= nums[mid]:
                right = mid
            else:
                left = mid + 1
        else:
            if nums[mid] < target <= nums[n - 1]:
                left = mid + 1
            else:
                right = mid
    return left if nums[left] == target else -1
def sample_funcname ( var_0 : List [ int ] , var_3 : int ) -> int :
    var_5 = len ( var_0 )
    var_7 , var_9 = 0 , var_5 - 1
    while var_7 < var_9 :
        var_10 = ( var_7 + var_9 ) >> 1
        if var_0 [ 0 ] <= var_0 [ var_10 ] :
            if var_0 [ 0 ] <= var_3 <= var_0 [ var_10 ] :
                var_9 = var_10
            else :
                var_7 = var_10 + 1
        else :
            if var_0 [ var_10 ] < var_3 <= var_0 [ var_5 - 1 ] :
                var_7 = var_10 + 1
            else :
                var_9 = var_10
    return var_7 if var_0 [ var_7 ] == var_3 else - 1
