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