Getting correct output (expected) in custom test case but fails for the same test case when submitted


#1

A : [ (13, 81), (15, 87), (23, 76), (41, 61), (53, 83), (23, 76), (44, 60), (1, 46), (36, 54), (48, 64), (21, 29) ]
I have problem with this test case, its correct answer is (1, 87), when i am submitting my solution it says your output is (1, 97) which off course is wrong but when i ran this test case as custom input it gives (1, 87) as answer which is the correct answer.
Somebody please help, my code is as follows -

bool cmp(Interval a, Interval b)
{
if(a.start==b.start)
return a.end<b.end;
else
return a.start<b.start;
}
vector Solution::merge(vector &A) {
vector v;
sort(A.begin(), A.end(), cmp);
/for(int i=0;i<A.size();++i)
cout<<A[i].start<<" "<<A[i].end<<endl;
/
for(int i=0;i<A.size();++i)
{
int j=i+1, mn=A[i].end, mx=A[i].start;
if(j<A.size())
{
while(max(mx, A[j].start)<=min(mn, A[j].end))
{
mx = min(mx, A[j].start);
mn = max(mn, A[j].end);
j++;
}
}
v.push_back(Interval(mx, mn));
i=j-1;
}
return v;
}


#2

I am also having the same issue.