标签:amp == solution tor twosum for target leetcode i+1
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
int n=nums.size();
int i,j;
vector<int> res(2);
for (i=0;i<n-1;i++){
for (j=i+1;j<n;j++){
if (nums[i]+nums[j]==target){
res[0]=i;
res[1]=j;
return res;
}
}
}
return res;
}
};
标签:amp == solution tor twosum for target leetcode i+1
原文地址:https://www.cnblogs.com/gale13/p/10982531.html