You are viewing a single comment's thread. Return to all comments →
Here is the most optimised and cleaner code (without constraint) for this problem:-
from collections import Counter no_of_shoes = int(input()) size_list = map(int, input().split(" ")) total_customers = int(input()) size_dict = Counter(size_list) earning = 0 for j in range(total_customers): i = list(map(int, input().split(" "))) if size_dict[i[0]]: earning += i[1] size_dict[i[0]] -= 1 print(earning)
`
Seems like cookies are disabled on this browser, please enable them to open this website
collections.Counter()
You are viewing a single comment's thread. Return to all comments →
Here is the most optimised and cleaner code (without constraint) for this problem:-
`