This project contains a function find_pairs that finds pairs of integers from a list that sum to a given value.
The project requires python 3 to be installed on your system.
To run the script, open a terminal and navigate to the directory containing the script pairs.py.
Run the script with the command:
python find_pairs.py <numbers> <target>
Where is a comma separated list of integers and is the target integer.
For example:
python find_pairs.py 1,9,5,0,20,-4,12,16,7 12
This will return:
+ 5,7
+ 0,12
+ 16,-4
To run the unit tests in this project, open a terminal in the root directory of the project and run the following command:
python -m unittest tests.test_pairs
The algorithm is efficient and correct, running in O(n) time.