Set .intersection() Operation

Sort by

recency

|

453 Discussions

|

  • + 0 comments

    For Python3 Platform

    n = int(input())
    english = set(map(int, input().split()))
    b = int(input())
    french = set(map(int, input().split()))
    
    print(len(english.intersection(french)))
    
  • + 0 comments

    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))

  • + 0 comments

    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)))

  • + 0 comments
    n= int(input())
    english =set(map(int,input().split()))
    b =int(input())
    french = set(map(int,input().split()))
    
    response= english&french
    print (len(response))
    
  • + 0 comments

    _,e=input(),set(input().split()) _,f=input(),set(input().split())

    print(len(e&f)) my simple, clean and efficient code