Skip to content

Commit ae42274

Browse files
committed
Update solution 001 Solution.js
1 parent ded5a47 commit ae42274

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

solution/001.Two Sum/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ class Solution {
2929
return null;
3030
}
3131
}
32-
```
32+
```

solution/001.Two Sum/Solution.js

+10
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)