hacker rank python (collections.Counter())solution

31.collections.Counter()

#counter just devvide list in keys and values
from collections import Counter
x=int(input())
sum=0
l=[]
shoes = Counter(map(int, raw_input().split()))
n=int(input())
for j in range(n):
sn ,sp = map(int, raw_input().split())
if(shoes[sn]>0):
sum = sum+sp
shoes[sn] -= 1
print(sum)

Comments

Popular posts from this blog

Amazon Web Services

Google Code-In mentorship experience :)

Hacker Rank all java and python problem solutions