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.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Python
  3. Sets
  4. Set .intersection() Operation
  5. Discussions

Set .intersection() Operation

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 334 Discussions, By:

recency

Please Login in order to post a comment

  • kunalkawate424
    2 weeks ago+ 0 comments
    if __name__=="__main__":
       n1=int(input())
       l1=set(map(int, input().split()))
       n2=int(input())
       l2=set(map(int, input().split()))
       l=l1.intersection(l2)
       print(len(l))
    
    0|
    Permalink
  • hudson_hornet
    2 weeks ago+ 0 comments
    # Enter your code here. Read input from STDIN. Print output to STDOUT
    n = int(input())
    eng = input()
    eng = {a for a in eng.split()}
    
    m = int(input())
    fren = input()
    fren = {b for b in fren.split()}
    
    eng.intersection_update(fren)
    
    print(len(eng))
    
    0|
    Permalink
  • shravyashet19
    3 weeks ago+ 0 comments
    n1=int(input())
    set1=set(map(int,input().split()))
    n2=int(input())
    set2=set(map(int,input().split()))
    print(len(set1.intersection(set2)))
    
    0|
    Permalink
  • ParulSharma024
    4 weeks ago+ 0 comments

    PYTHON 3

    input()
    set1 = set(map(int, input().split()))
    input()
    set2 = set(map(int, input().split()))
    print(len(set1 & set2))
    
    0|
    Permalink
  • komatiraju032
    1 month ago+ 0 comments
    input()
    s = set(input().split())
    input()
    print(len(s.intersection(input().split())))
    
    0|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy