mirror of
https://github.com/devenperez/leetcode.git
synced 2026-06-13 14:57:08 +00:00
Time: 173 ms (24.71%), Space: 42.1 MB (93.26%) - LeetHub
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @param {number[]} nums
|
||||
* @param {number} target
|
||||
* @return {number[]}
|
||||
*/
|
||||
var twoSum = function(nums, target) {
|
||||
for(let i = 0; i < nums.length; i++) {
|
||||
for(let j = i + 1; j < nums.length; j++) {
|
||||
if(nums[i] + nums[j] == target) {
|
||||
return [i, j];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user