https://leetcode.com/problems/two-sum/
1. Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution.
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
vector<int> params;
int size = nums.size();
int i = 0;
for(i; i <= size-1; i++){
for(int j = i + 1; j <= size-1; j++){
if(nums[i] + nums[j] == target){
params.push_back(i);
params.push_back(j);
i = size;
break;
}
}
}
return params;
}
};