I have two lists such as:
A=[1,2,3,4]
B=[3,6,7,8,9,10]
I want to compare these two list and if there is at least one element in common it return True otherwise False. Currently I am using the following:
Set(A)&Set(B)
However this is not the most efficient way for this purpose. I have more than 2 million sets with more than 10K elements in each that need to be compared. I really do not need to compare all elements.
Is there any build-in function for it in Python or do I need to write a custom function for it?