So given 2 unsorted arrays I have to find if any pairs of values (1 from each array) adds up to a target.
In javascript what I did was find the max and min values from array1, then make an array of size maxVal-minVal
.
I then iterated over array1 and put a 1 at every index of the new array corresponding to the values of array1.
From then I looped through array2 and checked if newArray[ target - array2[i] ] == 1
Is this a good solution to this problem?