You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
241 B
13 lines
241 B
var twoSum = function(nums, target) {
|
|
var i = 0;
|
|
var j = 0;
|
|
for (i = nums.length-1; i >= 0; i--){
|
|
for (j = i-1; j >= 0; j--){
|
|
if (nums[i] + nums[j] === target){
|
|
return [j, i];
|
|
}
|
|
}
|
|
}
|
|
|
|
return null;
|
|
};
|
|
|