#include <vector> class Solution { public: vector<int> FindNumbersWithSum(vector<int> array,int sum) { if(array.size()<2){ vector<int>ans; return ans; } int i=0,j=array.size()-1; while(i!=j){ if(array[i]+array[j]==sum){ vector<int>ans(2); ans[0]=array[i]; ans[1]=array[j]; return ans; } else if(array[i]+array[j]>sum){ j--; } else{ i++; } } vector<int> ans; return ans; } };