```
vector<int> twoSum(vector<int>& nums, int target)
{
int p1, p2;
vector<int> ans;
for (p1 = 0; p1<nums.size(); p1++)
{
p2 = p1 + 1;
ans.push_back(p1);
while (p2<=nums.size()
{
if (target == (nums[p1] + nums[p2]))
{
ans.push_back(p2);
return ans;
}
else
p2++;
}
ans.erase(ans.begin());
}
return ans;
}
```