From 6d229d2f3bb0dac025b12389b69621d26d671d12 Mon Sep 17 00:00:00 2001 From: Leandro Oliveira Date: Mon, 25 Oct 2021 22:04:00 -0300 Subject: [PATCH] feat: add solution problem in js --- leetcode/1 - twosum/two-sum.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 leetcode/1 - twosum/two-sum.js 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