We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 53ce7c7 commit b8001eeCopy full SHA for b8001ee
two-sum/jangwonyoon.js
@@ -0,0 +1,18 @@
1
+/**
2
+ * @param {number[]} nums
3
+ * @param {number} target
4
+ * @return {number[]}
5
+ */
6
+var twoSum = function(nums, target) {
7
+ const length = nums.length - 1;
8
+
9
+ for (let i = 0; i < length; i++) {
10
+ for (let j = length; j > 0; j--) {
11
+ const sum = nums[i] + nums[j];
12
13
+ if (sum === target) {
14
+ return [i, j];
15
+ }
16
17
18
+};
0 commit comments