#include #include using namespace std; namespace TwoSum{ class Solution { public: vector twoSum(vector& nums, int target) { vector res; map hashMap; for (int i = 0; i < nums.size(); i++) {//Loop through Dataset if (hashMap.find(target - nums[i]) != hashMap.end()) {//See if the remaining value is in the map res.push_back(i); res.push_back(hashMap[target - nums[i]]); return res; } else hashMap.emplace(nums[i], i); } return res; } }; }