就是二分法的基本使用

class Solution:
    def search(self , nums , target ):
        # write code here
        if not nums:
            return -1
        low = 0
        high = len(nums)-1
        while low <= high:
            mid = (low+high)//2
            if nums[mid] == target:
                return mid
            elif nums[mid] > target:
                high = mid - 1
            else:
                low = mid + 1
        return -1