代码:
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
vector<int> result;
int index1,index2;
for(index1=0;index1<nums.size();index1++)
for(index2=index1+1;index2<nums.size();index2++)
{
if(nums[index1]+nums[index2]==target)
{
result.push_back(index1);
result.push_back(index2);
return result;
}
}
}
};