We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 6699acf + 059cee3 commit 5e34cc1Copy full SHA for 5e34cc1
solution/001.Two Sum/README.md
@@ -29,4 +29,4 @@ class Solution {
29
return null;
30
}
31
32
-```
+```
solution/001.Two Sum/Solution2.js
@@ -0,0 +1,10 @@
1
+var twoSum = function(nums, target) {
2
+ var len = nums.length;
3
+ var n = {};
4
+ for(var i = 0; i < len; i++){
5
+ if(n[target - nums[i]] !== undefined){
6
+ return [n[target - nums[i]], i];
7
+ }
8
+ n[nums[i]] = i;
9
10
+};
0 commit comments