In this challenge, you need to implement a function that receives an array of integers (both positive and negative) and returns the first pair of integers that add up to form a given sum.
As an example:
getPairs([3, 4, 7, 6], 10); // Must return [3, 7]- If no valid pair of integers can be found, return
undefined - Your implementation must work for several different arrays of variadic length
- Your implementation will also run against an array of 5.000.000 integers
- The Winner will be the one that can submit the most performant version until Friday 2pm CET
- Build your solution in
index.js - Run
npm installoryarn install - Run
npm testoryarn test - No Errors? Go ahead and submit a Pull Request!