Skip to content

Latest commit

 

History

History
19 lines (12 loc) · 505 Bytes

README.md

File metadata and controls

19 lines (12 loc) · 505 Bytes

Two sum

Description

You will be given an array and a target sum and your goal is to find all pairs in the given array that add up to the target sum.

Implementation

twoSum(numArray, sum) should return every pair of numbers from numArray that adds up to the sum.

There are some conditions:

  • result should be an array of arrays.
  • any number in the numArray can be used in multiple pairs.

For example:

twoSum([1, 6, 4, 5, 3, 3], 7) // [ [6, 1], [3, 4], [3, 4] ]