/** * * @param numbers int整型一维数组 * @param target int整型 * @return int整型一维数组 */ function twoSum( numbers , target ) { // write code here let obj = []; for(let i = 0;i<numbers.length;i++){ for(let j = 0;j<numbers.length;j++){ // obj[`${i}${j}`] = nums[i]+nums[j]; if(target === numbers[i]+numbers[j] && i!==j){ obj = [i+1,j+1] } } } return obj.sort(function(a,b){ return a-b }); } module.exports = { twoSum : twoSum };