Please anyone can explain me whats wrong with my code


#1

bool compare(Interval a,Interval b){
if(a.start<b.start) return 1;
}
vector Solution::merge(vector &A) {
vectorv;
int n=A.size();
sort(A.begin(),A.end(),compare);
int j=0;
for(int i=1;i<n;i++){
if(A[i].start<=A[j].end){
A[j].start=min(A[i].start,A[j].start);
A[j].end=max(A[j].end,A[i].end);
}else{
j++;
A[j]=A[i];
}
}

for(int i=0;i<=j;i++){
    v[i].start=A[i].start;
    v[i].end=A[i].end;
} 
return v;
// Do not write main() function.
// Do not read input, instead use the arguments to the function.
// Do not print the output, instead return values as specified
// Still have a doubt. Checkout www.interviewbit.com/pages/sample_codes/ for more details

}