Skip to content

Instantly share code, notes, and snippets.

@Mk-Etlinger
Created February 1, 2018 04:43
Show Gist options
  • Select an option

  • Save Mk-Etlinger/2116d70268e87dd7b5ded7cbf3d1bf51 to your computer and use it in GitHub Desktop.

Select an option

Save Mk-Etlinger/2116d70268e87dd7b5ded7cbf3d1bf51 to your computer and use it in GitHub Desktop.
Leetcode twoSum #1
var twoSum = function(nums, target) {
let indicesArray = [];
for (let i = 0; i < nums.length; i++) {
for (let k = i + 1; k < nums.length; k++) {
if (nums[i] + nums[k] === target) {
indicesArray.push(i, k)
}
}
}
return indicesArray;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment