classSolution { public: vector<int>twoSum(vector<int>&numbers, inttarget) { intleft=0,right=numbers.size()-1; while(left<=right){ intsum=numbers[left]+numbers[right]; if(sum==target){ return{left+1,right+1}; } elseif(sum<target){ ++left; } elseif(sum>target){ --right; } } return{-1,-1}; } };