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. Collections
  4. collections.Counter()
  5. Discussions

collections.Counter()

Problem
Submissions
Leaderboard
Discussions
Editorial

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

  • chizhkovaMV
    5 years ago+ 3 comments

    without counters... coz i think there is no need to use it here

    n = input()
    boots = map(int, raw_input().split())
    orders = [map(int, raw_input().split()) for _ in range(input())]
    result = 0
    for i in orders:
        if i[0] in boots:
            result += i[1]
            boots.remove(i[0])
    print result
    
    27|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature