Write a method numberOfSumCombinations that takes in three arguments: an IntArray called first, an
IntArray called second, and an Int number called target. This method must return the number of
ways (as an Int) that target can be obtained by summing a value from the first array with a value from the
second
array.
For example: given that first = [1, 2, 3, 4, 5], second = [6, 7, 8, 9, 10], and target = 10,
numberOfSumCombinations will return 4 because the target (10) can be summed in 4 ways (by adding one value from
first and one value from second): 1+9, 2+8, 3+7, and 4+6.
Note #1: A valid combination is a sum of two elements: the first element must be from the first
array, and the second
element must be from the second array.
Note #2: The two array arguments are guaranteed to be the same size.
Note #3: It's recommended to use a nested for loop to solve this problem.
Stuck? You may find these lessons helpful: