Offer57.和为s的两个数字/Solution.java
<gh_stars>0class Solution {
    public int[] exchange(int[] nums) {
        int left = 0, right = nums.length - 1;
        while (left < right) {
            int s = nums[left] + nums[right];
            if (s > target) right--;
            else if (s < target) left++;
            else return new int[]{nums[left], nums[right]};
        }
        return new int[0];
    }
}