LeetCode力扣 167. 两数之和 II - 输入有序数组 Two Sum II - Input array is sorted 题解代码 JavaScript

问题 https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/

练习使用JavaScript解答

/**
 * @param {number[]} numbers
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function(numbers, target) {
    var i = 0, j = numbers.length-1;
    while(i target)
            --j;
        else
            ++i;
    }
};

 

你可能感兴趣的:(LeetCode题解,LeetCode,力扣,javascript,两数之和,算法)