2019-08-11

image.png

java语言描述

class Solution {
    //两次二分查找  二段式
    public int[] searchRange(int[] nums, int target) {
        int[] targetRange = {-1, -1};
        if(nums==null  || nums.length==0)
            return targetRange;
        int l=0 , r=nums.length-1;
        while(l=target)
                r=mid;
            else
                l=mid+1;
        }
        if(nums[r]!=target)   
            return targetRange;
        int start=r;
        int a=0 , b=nums.length-1;
        while(a

你可能感兴趣的:(2019-08-11)