See More

class Solution { public: vector twoSum(vector& numbers, int target) { int i,j, n= numbers.size(); vector res(2,-1); i=0;j=n-1; while (itarget) j--; else i++; } return res; } }; //============================================================== //Time complexity of the above algorith: O(n), n is the length of the input array //Space complexity: O(1), constant space