需求
代码
class Solution:def searchInsert(self, nums: List[int], target: int) -> int:if max(nums) >=target:for i in range(len(nums)-1):if nums[i+1] >= target and nums[i] <target:return i+1if max(nums) <target:return len(nums)if min(nums) >= target:return 0if target < nums[0]:return 0if len(nums) ==1 and nums[0] == target:return 0