今天开始刷leetcode,先水一道未尽,不过不习惯给API编程这种方式 题目链接https://leetcode-cn.com/problems/two-sum/
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
vector<int> pp;
for(int i=0;i<nums.size()-1;i++){
for(int j=i+1;j<nums.size();j++){
if(nums[i]+nums[j]==target){
pp.push_back(i);
pp.push_back(j);
}
}
}
return pp;
}
};