C++ 代码
class Solution {
public:
vector<int> findNumbersWithSum(vector<int>& nums, int target) {
unordered_map<int, bool> hash;
for(auto &x:nums) {
if(hash[target - x]) return vector<int>{x, target - x};
else hash[x] = true;
}
}
};