def searchInsert(nums, target): for i in nums: if i>=target: return nums.index(i) if nums[0]>=target: return 0 else: return len(nums)
原文地址:https://www.cnblogs.com/zhangtianxia/p/9038483.html
时间: 2024-11-09 00:45:42
def searchInsert(nums, target): for i in nums: if i>=target: return nums.index(i) if nums[0]>=target: return 0 else: return len(nums)
原文地址:https://www.cnblogs.com/zhangtianxia/p/9038483.html