I have the following arrays:
A = [1,2,3,4,5] B = [2,6,7,1]
I want to find disjoint elements that look like this:
output = [3,4,5,6,7]
I was able to achieve this as follows:
output = A + B - (A & B)
but it is inefficient as I add two arrays and then delete the common elements. This is similar to finding disjoint elements. Can I do it better than this? If so, how?
source share