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