Skip to content

Instantly share code, notes, and snippets.

@nickbalestra
Last active April 7, 2018 02:34

Revisions

  1. nickbalestra revised this gist Apr 7, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion twoSum.js
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@
    * Input: nums = [2, 7], target = 9,
    * Output: [0, 1] // Because nums[0] + nums[1] = 2 + 7 = 9,
    *
    * Follow-up: What will change if the array of integers will be given sorted
    * Follow-up: What will change if the given array of integers is sorted
    *
    */

  2. nickbalestra revised this gist Apr 7, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion twoSum.js
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@
    * and you may not use the same element twice.
    *
    * Example:
    * Input: nums = [2, 7, 11, 15], target = 9,
    * Input: nums = [2, 7], target = 9,
    * Output: [0, 1] // Because nums[0] + nums[1] = 2 + 7 = 9,
    *
    * Follow-up: What will change if the array of integers will be given sorted
  3. nickbalestra created this gist Apr 7, 2018.
    20 changes: 20 additions & 0 deletions twoSum.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    /*
    * Two Sum
    *
    * Given an array of integers, return indices of the two numbers
    * such that they add up to a specific target.
    *
    * You may assume that each input would have exactly one solution,
    * and you may not use the same element twice.
    *
    * Example:
    * Input: nums = [2, 7, 11, 15], target = 9,
    * Output: [0, 1] // Because nums[0] + nums[1] = 2 + 7 = 9,
    *
    * Follow-up: What will change if the array of integers will be given sorted
    *
    */

    const twoSum = (nums, target) => {};

    module.exports = twoSum;
    1 change: 1 addition & 0 deletions twoSum.test.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    const twoSum = require('./twoSum')