I want to check if two arrays a and b intersect. Given a = [3, 21] and b = [15, 26530, 21, 3], the answer should be true. Given
If a = [3, 21] and b = [15, 26530], the answer should be false.
I tried:
a.to_set.intersect?(b.to_set)
but this method takes a long time. How can I do it quickly?