Set .intersection() Operation

Sort by

recency

|

458 Discussions

|

  • + 0 comments
    n = int(input())
    set_eng = set(map(int, input().split()))
    
    b = int(input())
    set_fre = set(map(int, input().split()))
    
    final_set = set_eng.intersection(set_fre)
    
    print(len(final_set))
    
  • + 0 comments

    a=input() //If m contains more element than a , It is not occur an error. // this logic only for no of elements not specific no of elements

    m=set([int(i) for i in input().split()]) b=input() n=set([int(i) for i in input().split()]) print(len(m&n))

  • + 0 comments

    Here is HackerRank Set .intersection() Operation in python solution - https://programmingoneonone.com/hackerrank-set-intersection-operation-solution-in-python.html

  • + 0 comments
    m=input()
    l=set(map(int,input().split()))
    n=input()
    s=set(map(int,input().split()))
    print(len(s.intersection(l)))
    
  • + 0 comments
    n=input()
    e=set(input().split())
    b=input()
    f=set(input().split())
    print(len(e&f))