Wrong answer. please check my code


#1

int Solution::countInversions(vector &A) {
int count=0,i,j;
vector temp;
for(i=0;i<A.size();i++)
temp.push_back(A[i]);
sort(temp.begin(),temp.end());
vector::iterator it;
for(i=0;i<A.size();i++)
{
j=(find(A.begin(),A.end(),temp[i])-A.begin());
if((i-j)>0)
count+=(i-j);
}
return count;
}


#2

the logic is not right, e.g you solution fail on [3, 2, 1]