```
Maybe helpful for someone.
class Solution
{
public:
vector<int> twoSum(vector<int>& nums, int target)
{
static int MAX = 99999;
static int DELT = 49999;
vector<int> ans;
int x[MAX];
memset(x, 0, sizeof(x));
for (int i = 0; i < nums.size(); i++)
{
if (x[nums[i] + DELT])
{
ans.push_back(((i + 1) < x[nums[i] + DELT] ?
(i + 1) : x[nums[i] + DELT]));
ans.push_back(((i + 1) > x[nums[i] + DELT] ?
(i + 1) : x[nums[i] + DELT]));
return ans;
}
x[target - nums[i] + DELT] = i + 1;
}
}
};
```