<doocs>0081.Search in Rotated Sorted Array II_1.py
def search( nums: List[int], target: int) -> bool:
    l, r = 0, len(nums) - 1
    while l <= r:
        mid = (l + r) >> 1
        if nums[mid] == target:
            return True
        if nums[mid] < nums[r] or nums[mid] < nums[l]:
            if target > nums[mid] and target <= nums[r]:
                l = mid + 1
            else:
                r = mid - 1
        elif nums[mid] > nums[l] or nums[mid] > nums[r]:
            if target < nums[mid] and target >= nums[l]:
                r = mid - 1
            else:
                l = mid + 1
        else:
            r -= 1
    return False
def sample_funcname ( var_0 : List [ int ] , var_3 : int ) -> bool :
    var_6 , var_9 = 0 , len ( var_0 ) - 1
    while var_6 <= var_9 :
        var_10 = ( var_6 + var_9 ) >> 1
        if var_0 [ var_10 ] == var_3 :
            return True
        if var_0 [ var_10 ] < var_0 [ var_9 ] or var_0 [ var_10 ] < var_0 [ var_6 ] :
            if var_3 > var_0 [ var_10 ] and var_3 <= var_0 [ var_9 ] :
                var_6 = var_10 + 1
            else :
                var_9 = var_10 - 1
        elif var_0 [ var_10 ] > var_0 [ var_6 ] or var_0 [ var_10 ] > var_0 [ var_9 ] :
            if var_3 < var_0 [ var_10 ] and var_3 >= var_0 [ var_6 ] :
                var_9 = var_10 - 1
            else :
                var_6 = var_10 + 1
        else :
            var_9 -= 1
    return False
