```
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
map<int,int> map1;
for(int i = 0; i < nums.size(); i++) {
if(map1.find(target-nums[i]) != map1.end()) {
vector<int> a = { map1[target-nums[i]], i+1};
return a;
}
map1[nums[i]] = i+1;
}
}
};
```