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
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Python
  3. Sets
  4. Set .union() Operation
  5. Discussions

Set .union() Operation

Problem
Submissions
Leaderboard
Discussions
Editorial

    You are viewing a single comment's thread. Return to all comments →

  • marinskiy
    4 years ago+ 6 comments

    Here is Python 3 solution from my HackerrankPractice repository:

    _, a = input(), set(input().split())
    _, b = input(), set(input().split())
    print(len(a.union(b)))
    

    Feel free to ask if you have any questions :)

    32|
    Permalink
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature