diff --git a/leetcode/1 - twosum/two-sum.js b/leetcode/1 - twosum/two-sum.js new file mode 100644 index 0000000..d72731f --- /dev/null +++ b/leetcode/1 - twosum/two-sum.js @@ -0,0 +1,9 @@ +var twoSum = function (nums, target) { + for (var i = 0; i < nums.length; i++) { + for (var j = i + 1; j < nums.length; j++) { + if (nums[i] + nums[j] === target) { + return [i, j]; + } + } + } +}; \ No newline at end of file