class Solution {
public:
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param numbers int整型vector
* @return int整型
*/
int duplicate(vector<int>& numbers) {
vector<int> newarray(numbers.size());
if(numbers.size()==0){
return -1;
}
for(int i=0;i<numbers.size();i++){
newarray[numbers[i]]+=1;
printf("%d",newarray[numbers[i]]);
if(newarray[numbers[i]]==2){
return numbers[i];
}
}
return -1;
}
};
class Solution {
public:
int mod=1000000007;
int mergeSort(int left,int right,vector<int>& data, vector<int>& temp){
//停止划分,即划分至长度为1时
if(left>=right){return 0;}
//mid
int mid=(right+left)/2;
int count=mergeSort(left, mid, data, temp)+mergeSort(mid+1, right, data, temp);
count%=mod;
int i=left;int j=mid+1;
for(int k=left;k<=right;k++){
temp[k]=data[k];
}
for(int k=left;k<=right;k++){
}
}
int InversePairs(vector<int> data) {
int n=data.size();
vector<int> temp(n);
mergeSort(0,n-1, data,temp);
}
};