sky068 / gitalk

gitalk comments, hexo+gitalk 评论
0 stars 0 forks source link

二分查找 | 徐家伟的博客 #43

Open sky068 opened 4 years ago

sky068 commented 4 years ago

https://xujiawei.top/2020/05/08/%E4%BA%8C%E5%88%86%E6%9F%A5%E6%89%BE/

123456789101112def searchInsert(nums, target): left = 0 right = len(nums) - 1 while left <= right: mid = (left + right) // 2 if target == nums[mid]: return mid