We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Set .intersection() Operation
Set .intersection() Operation
Sort by
recency
|
453 Discussions
|
Please Login in order to post a comment
For Python3 Platform
n=int(input()) eng=set(map(int,input().split())) m=int(input()) french=set(map(int,input().split())) both=eng.intersection(french) numboth=list(both) print(len(numboth))
en = input() en_ids = set(map(int, input().split()))
fr = input() fr_ids = set(map(int, input().split()))
print(len(en_ids.intersection(fr_ids)))
_,e=input(),set(input().split()) _,f=input(),set(input().split())
print(len(e&f)) my simple, clean and efficient code