LC35. 搜索插入位置

/**
 * @Classname Solution1
 * @Description
 * @Date 2020/1/13 18:46
 * @Author SonnSei
 */
public class Solution1 {
    public int searchInsert(int[] nums, int target) {
        int pos = Arrays.binarySearch(nums, target);
        return pos<0?-pos-1:pos;
    }
}
发布了140 篇原创文章 · 获赞 2 · 访问量 1882

猜你喜欢

转载自blog.csdn.net/weixin_40602200/article/details/103962628
今日推荐