classSolution: defsearchInsert(self, nums: List[int], target: int) -> int: left = 0 right = len(nums)-1 while left<=right: half = left+(right-left)//2 if nums[half]<target: left = half+1 if nums[half]>target: right = half-1 if nums[half]==target: return half if target>nums[half]: return half+1 else: return half # for id in range(len(nums)): # if target - nums[id]<0: # return id