/** the sum of two numbers *@param {number[]} ns
* @param {number} target
* @return {number[]}* /
var twoSum = function(ns, target) {
for(var i=0; i<ns.length; i++){for(var j=i+1; j<ns.length; j++){if(ns[i]+ns[j]==target){
console.log([i,j]);
return[i,j]; }}}}; twoSum([1.2.3.4].5) / / [0, 3]
Copy the code