- node : v18.16.1
- npm : 9.5.1
- nvm : 0.39.1
npm install
npm run start
npm run test
npm run test
- a folder
/coverage
will be created - in the route
/coverage/lcov-report/index.html
- open the
index.html
with the preferred browser
The task is to write a function that finds pairs of integers from a list that sum to a given value. The function will take as input the list of numbers as well as the target sum. Sample output is shown below.
> app 1,9,5,0,20,-4,12,16,7,12
+ 12,0
+ 5,7
+ 16,-4
In the example, there is an executable named app
. It takes as command line
arguments a comma separated list of integers, and the target integer. Your app
doesn't need to have identical input/output mechanisms. For example, you could
read from a file instead of the command line.
You can assume that all input values are integers. You can assume that there aren't
any repeat values in the list.
The algorithm to find the pairs must be faster than O(n^2). All edge cases
should be handled appropriately. This is not a closed book test. You are
encouraged to reach out with any questions that you come across.