剑指 Offer 11. 旋转数组的最小数字_List

class Solution:
    def minData(self, numbers, index1, index2):
        minD = numbers[index1]
        for i in range(index1, index2+1, 1):
            if minD > numbers[i]:
                minD = numbers[i]
        return minD
    def minArray(self, numbers: List[int]) -> int:
        if len(numbers) == 1:
            return numbers[0]
        index1, index2 = 0, len(numbers) - 1
        indexMid = 0
        while numbers[index1] >= numbers[index2]:
            if index2 - index1 == 1:
                return numbers[index2]
            indexMid = (index1 + index2) // 2
            if numbers[index1] == numbers[index2] and numbers[indexMid] == numbers[index1]:
                return self.minData(numbers, index1, index2)
            if numbers[index1] <= numbers[indexMid]:
                index1 = indexMid
            elif numbers[index2] >= numbers[indexMid]:
                index2 = indexMid
        return numbers[indexMid]