标签:tor array col return public tco color c++ code
class Solution { public: vector<int> twoSum(vector<int>& numbers, int target) { int n = numbers.size(); vector<int> result; int i = 0; for (i = 0;i<n&&numbers[i]<= target;i++){ for (int j = i+1;j<n&&numbers[j]<=target;j++){ if (numbers[i]+numbers[j] == target){ result.push_back(i+1); result.push_back(j+1); return result; } } } return {}; } };
leetcode 之 Two Sum II - Input array is sorted c++
标签:tor array col return public tco color c++ code
原文地址:https://www.cnblogs.com/bingLblog/p/10654129.html