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 →

  • HMoroliya
    1 year ago+ 4 comments

    Samajh me aaye to "Copy That" XD

    from collections import Counter
    
    if __name__ == '__main__':
        total_joote, joote_ki_variety, total_grahak = (input(), Counter(map(int, input().split())), int(input()))
        galle_me_kitne_pese=0
        
        # Noto ki Barish 
        for _ in range(total_grahak):
            joota_ek_number_bada_dikhao, noto_ki_to_barish_ho_rai_hai = map(int, input().split())
            if joote_ki_variety[joota_ek_number_bada_dikhao] :
                galle_me_kitne_pese+=noto_ki_to_barish_ho_rai_hai
                joote_ki_variety[joota_ek_number_bada_dikhao]-=1
                
        # Aaj Ki Kamai
        print(galle_me_kitne_pese)
    
    7|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature