```
public class Solution {
public int[] searchRange(int[] nums, int target) {
int lo=0;
int high=nums.length-1;
int[] ans={-1,-1};
if(nums.length<1) return ans;
while(high>lo){
int mid=lo+(high-lo)/2;
if(nums[mid]<target){
lo=mid+1;
}else{
high=mid;
}
}
if(nums[lo]!=target){return ans;}
else{
ans[0]=lo;
while(++lo<=nums.length-1&&nums[lo]==target){}
ans[1]=lo-1;
}
return ans;
}
}
```