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
  • Apply
  • Hiring developers?
  1. Prepare
  2. Python
  3. Sets
  4. Set .intersection() Operation
  5. Discussions

Set .intersection() Operation

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 379 Discussions, By:

recency

Please Login in order to post a comment

  • singhsaloni890
    1 week ago+ 0 comments
    eng = int(input())
    eng_roll = set(map(int, input().split()))
    frn = int(input())
    frn_roll = set(map(int, input().split()))
    total = eng_roll.intersection(frn_roll)
    print(len(total))
    
    0|
    Permalink
  • n_n_a_24289
    1 week ago+ 0 comments
    n, set_n = int(input()), set(map(int, input().split()))
    b, set_b = int(input()), set(map(int, input().split()))
    
    both_subs = set_n.intersection(set_b)
    print(len(both_subs))
    
    0|
    Permalink
  • roseline_dataen1
    2 weeks ago+ 0 comments
    n = int(input())
    eng_rollnos = set(map(int, input().split()))
    b = int(input())
    fre_rollnos = set(map(int, input().split()))
    result = eng_rollnos.intersection(fre_rollnos)
    print(len(result))
    
    0|
    Permalink
  • 7RiXxSec
    2 weeks ago+ 0 comments
    input() #discard arbitrary input
    studeng = set(input().split())
    input() #discard arbitrary input
    studfre = set(input().split())
    
    print(len(studeng.intersection(studfre)))
    
    0|
    Permalink
  • ashish98875
    3 weeks ago+ 0 comments
    n,s1=input(),set(input().split())
    n,s2=input(),set(input().split())
    print(len(s1.intersection(s2)))
    
    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