Whats wrong with this code(c++)


#1

double Solution::findMedianSortedArrays(const vector &a, const vector &b) {

int minm=INT_MAX;
int maxm=INT_MIN;
if(a.size()!=0 )
{ minm=a[0];
maxm=a[a.size()-1];}

if(b.size()!=0)
{
minm=min(minm,b[0]);
maxm=max(maxm,b[b.size()-1]);
}

double mid=(double)(minm+(maxm-minm)/2);

while(minm<maxm)
{ int count=0;
mid=(double)(minm+(maxm-minm)/2);

     count += upper_bound(a.begin(),a.end(),mid) - a.begin();
     count += upper_bound(b.begin(),b.end(),mid) - b.begin();
       
      
    if(count<(a.size()+b.size())/2+1)    
        minm=mid+1;
    else
        maxm=mid;

}
return mid;

}