昨日当年

你一双澄澈眼眸 便使我颠沛中毕生富有

LeetCode 1. 两数之和 JS

LeetCode 1. 两数之和 JS

好弱哈哈~~

/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function(nums, target) {
    var answer = []
    dance:
    for(let i = 0; i < nums.length ; i++) {
        for(let s = i+1; s < nums.length ; s++) {
            if (target - nums[i] === nums[s]) {
                answer.push(i)
                answer.push(s)
                break dance
            }
        }
    }
    return answer
};