For example
inputarray = [1, 4, 5, 9];
array1 = [1, 2, 3, 4, 5, 6, 7];
array2 = [8, 9, 10, 11, 12, 13, 14];
I would like to match inputarray with both array1 & array2.In this current scenario 1,4,5 belongs to the array1 and 9 belongs to the second array.I am expecting the output like
outputarray1=[1,4,5]
outputarray2=[9]
Suggest me best way to do this problem.I mean with less complexity.Thanks in advance.