class Solution {
public:
    vector<int> FindNumbersWithSum(vector<int> array,int sum) {
        vector<int>ret;
        int len = array.size();
        int left = 0, right = len - 1;
        while(left < right) {
            int cnt = array[left] + array[right];
            if (cnt == sum) {
                ret.push_back(array[left]);
                ret.push_back(array[right]);
                return ret;
            } else if (cnt > sum) {
                right --;
            } else {
                left ++;
            }
        }
        return ret;
    }
};