class Solution:
    def get_min(self, nums):
        if not nums:
            return None

        left, right = 0, len(nums) - 1
        while left < right:
            if nums[left] <= nums[right]: # not rotated
                break
            mid = (left + right) // 2
            if nums[mid] < nums[left]: # min must be on the left of mid or mid
                right = mid
            else: # min must be on the right of mid
                left = mid + 1
        
        return nums[left]

solution = Solution()
nums = [7,0,1,2,3,4,5,6]
# nums = [4,5,6, 7, 8, 1, 2, 3]
print(solution.get_min(nums))
