class Solution: def search(self, nums: List[int], target: int) -> int: try: low = 0 high = len(nums)-1 while low <= high: mid = low + (high - low)//2 if nums[mid] == target: return mid elif nums[mid] <= target: low = mid + 1 else: high = mid - 1 return -1 except Exception as e: print(e)