using std::cin; using std::cout; using std::endl; using std::getline; using std::map; using std::string; using std::stringstream; using std::to_string; using std::vector;
classSolution { public: vector<int> twoSum(vector<int> &nums, int target) { map<int, int> remainval_index_map; vector<int> result; for (int i = 0; i < nums.size(); i++) { if (remainval_index_map.find(nums[i]) != remainval_index_map.end()) { result.push_back(remainval_index_map[nums[i]]); result.push_back(i); break; } remainval_index_map[target - nums[i]] = i; } return result; } };