def rotated_array_search(input_list, number):
    """
    Find the index by searching in a rotated sorted array

    Args:
       input_list(array), number(int): Input array to search and the target
    Returns:
       int: Index or -1
    """
    # As array is sorted (even if it is rotated), with a little tweak to the binary search logic we can use
    # binary search and achieve the desired solution in ln(n)
    n = len(input_list)
    start = 0
    end = n - 1
    while start <= end:
        m = (start + end) // 2
        if input_list[m] == number:
            return m
        elif input_list[start] > input_list[end]:  # check if array part [start, end] is rotated or not
            # if input_list[start] > input_list[end] then that means the array part we are checking still contains
            # rotated numbers
            if number <= input_list[end]:
                # if number <= input_list[end] then that means number is in range [m+1, end]
                start = m + 1
            else:
                # if number > input_list[end] then that means number is in range [start, m-1]
                end = m - 1
        # below are the cases executed only when current array range [start, end] is not rotated
        elif number > input_list[m]:
            # number is in range [m+1, end]
            start = m + 1
        else:
            # number < mid number so number is in range [start, m-1]
            end = m - 1

    return -1