github.com/F-Smith/algo-max-min-arr-diff
Fork this repo and then git clone
your forked repo to your computer.
Once you're happy with your solution, git push
and submit a pull request at
github.com/F-Smith/algo-max-min-arr-diff
.
Write a function called maxAndMin
that accepts 2 arrays of positive integers. The function should return an array containing the largest and smallest difference between a number in array one and a number in array two.
e.g. maxAndMin([2,5],[3,6]) ===> [4,1]
Input => Output
---------------------------------------------------------------
maxAndMin([21,7,15,8],[3,10,6]) === [18,1]
maxAndMin([20],[5]) === [15,15]
maxAndMin([4,10,5],[4,10,5]) === [6,0]
maxAndMin([6,7,8,9,10],[1,2,3,4,5]) === [9,1]
To test your solution, run npm i
in the root directory
and then run npm t
to run the automated tests.
To submit your solution:
- If you're working on a forked repo, push your changes to your forked repo and submit a pull request to this repo.