public int[] searchRange(int[] A, int target) {
        int l=0, r=A.length-1, mid=A.length/2;
        boolean bfound = false;
        while(l<=r)
        {
        	if(A[mid]<target)
        	{
        		l=mid+1; 
        		mid=(l+r)/2;
        	}else if(A[mid]>target)
        	{
        		r=mid-1;
        		mid=(l+r)/2;
        	}else
        	{
        		bfound =  true;
        		break;
        	}
        }
        
        if(!bfound) 
        {
        	int[] res = {-1, -1};
        	return res;
        }
        int min = mid, max = min;
        while(min>=0 && A[min] == target)
        {
        	min--;
        }
        while(max<A.length && A[max] == target)
        {
        	max++;
        }
        int[] res = {min+1, max-1};
        return res;
    }