class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
map<int,int> search_map;
for(auto i = 0; i != search_map.size(); i++){
auto iter = search_map.find(target-search_map[i]);
if (iter == search_map.end())
search_map.insert(pair<int,int>(search_map[i],i));
else
vector<int> rst;
rst.push_back(iter->second);
rst.push_back(i);
return rst;
}
}
};
solution.cpp: In member function twoSum
Line 11: Char 17: error: 'rst' was not declared in this scope
rst.push_back(iter->second);
^~~
--
修改:ssdd FROM 218.200.70.*
FROM 218.200.70.*