Hi, I posted a previous answer regarding this problem. I tried to resolve sorting the array and then finding the sums using two indexes, one at the front and another one at the end. I know this can be solved using a hash table but for the moment I'm trying this as well. Thing is, I get runtime error... don't know why. Help is very much appreciated. Thanks

```
class Solution {
public:
vector<int> twoSum(vector<int> &numbers, int target) {
int index1, index2, a, b;
vector<int> solution(2);
//Sort
for (int i=0; i<numbers.size(); i++)
{
int k = i;
int x = numbers[i];
for (int j=i+1; j<=numbers.size(); j++)
{
if (numbers[j]<x)
{
k=j;
x=numbers[k];
}
}
numbers[k] = numbers[i];
numbers[i]=x;
}
//Look for sum
b=numbers.size();
while (a<b)
{
if (numbers[a] + numbers[b] > target)
{
b--;
}
else if (numbers[a] + numbers[b] < target)
{
a++;
}
else
{
solution.push_back(a);
solution.push_back(b);
return solution;
}
}
}
};
```