# In case when b[0] <0 input is wrong it is not reading b[0]. check my code

#1

int Solution::solve(vector &A, vector &B, vector &C) {
int a=A.size(),b=B.size(),c=C.size(),i=0,j=0,k=0,min,w=0,d,e=B[0],f=C[0],x,max,med,l,m,n=0;
d=A[0];
e=B[0];
f=C[0];
m = -2;

// cout << (n-m)<<endl;
if((d<=e)&&(d<=f)){
min=d;
i++;
if(e<=f){
max=f;
}
else{
max=e;
}
}
else if(e<=f){
min = e;
j++;
if(d<=f){
max=f;
}
else{
max=d;
}
}
else{
min=f;
k++;
if(d<=e){
max=e;
}
else{
max=d;
}
}
x=max-min;

// return (x);
while((i<a)&&(j<b)&&(k<c)){
if((A[i])==min){

``````        if(i==a-1){
break;
}
i++;
}
else if(B[j]==min){

if(j==b-1){
break;
}
j++;
}
else {

if(k==c-1){
break;
}
k++;
}

if((A[i]<=B[j])&&(A[i]<=C[k])){
min=A[i];
if(B[j]<=C[k]){
max=C[k];
}
else{
max=B[j];
}
}
else if(B[j]<=C[k]){
min = B[j];
if(A[i]<=C[k]){
max=C[k];
}
else{
max=A[i];
}
}
else{
min=C[k];
if(A[i]<=B[j]){
max=B[j];
}
else{
max=A[i];
}
}
``````

// cout << i<<endl;
l=(max)-1*(min);
// cout << max << ’ '<< min <<endl;
// cout << w << endl;
if(l<=x){

``````     x=l;

w=l;
}
}

return (x);
``````

}