Set .difference() Operation

Sort by

recency

|

372 Discussions

|

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

    dont trust the constraints they are the ones that gives them but doesnt follow them and even shows us the error(here they told the sum of them should be less than 1000 ) but at last they give test cases where the value exceeds.

  • + 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.difference(french)))
    
  • + 0 comments

    n=int(input()) eng=set(map(int,input().split())) m=int(input()) french=set(map(int,input().split())) only_eng1=eng.difference(french) onlyeng2=list(only_eng1) print(len(onlyeng2))