欢迎来我Python萌新的小站

[LEEDCode][035][简单] – 搜索插入位置(search-insert-position)

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.

You may assume no duplicates in the array.

给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。

你可以假设数组中无重复元素。

示例 1:

示例 2:

示例 3:

示例 4:

解答

自测用例

运行结果

提交时间 状态 执行用时 语言
几秒前 通过 52 ms python3
喜欢 (1)分享 (0)
发表我的评论
取消评论
友情提示:插入代码时请使用:  <pre>要插入的代码</pre>   以达到最佳效果!

表情     5 + 6 = ? (必填)

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址