class Solution {
public:
vector<int> twoSum(vector<int> &numbers, int target) {
vector<int> result(2,0);
int i=1;
for(vector<int>::iterator iter1=numbers.begin();iter1!=numbers.end()-1;iter1++,i++)
{
int j=2;
for(vector<int>::iterator iter2=iter1+1;iter2!=numbers.end();iter2++,j++)
{
if(*iter1+*iter2==target)
{
result[0]=i;
result[1]=j;
return result;
}
}
}
}
};
时间复杂度为O(n^2),不可行