Skip to content

Commit

Permalink
Added solition for sashaaero#1 in Javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
Meldiron committed Oct 10, 2019
1 parent bccf0d6 commit 6aa97ff
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions leet_1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// https://leetcode.com/problems/two-sum/submissions/
// Runtime: 112 ms, faster than 37.73% of JavaScript online submissions for Two Sum.

/**
* @param {number[]} nums
* @param {number} target
* @return {number[]}
*/
var twoSum = function(nums, target) {
for(let i = 0; i < nums.length; i++) {
for(let y = i + 1; y < nums.length; y++) {
if(nums[i] + nums[y] === target) {
return [i, y];
}
}
}
};

0 comments on commit 6aa97ff

Please sign in to comment.