public int[] searchRange0(int[] nums, int target) {
        int[] pos = new int[]{-1, -1};

        int start = 0, end = nums.length-1;

        while(start <= end) {
            int mid = start + (end-start)/2;

            if(nums[mid] == target) {
                for(int i = mid-1; i >= -1; i--) {
                    if(i == -1 || nums[i] != target) {
                        pos[0] = i+1;
                        break;
                    }
                }
                for(int i = mid+1; i <= nums.length; i++) {
                    if(i == nums.length || nums[i] != target) {
                        pos[1] = i-1;
                        break;
                    }
                }
            }

            if(nums[mid] > target) {
                end = mid -1;
            } else {
                start = mid + 1;
            }
        }

        return pos;
    }