You are viewing a single comment's thread. Return to all comments →
Here is Python 3 solution from my HackerrankPractice repository:
import collections number_of_shoes = int(input()) sizes_in_stock = collections.Counter(map(int, input().split())) total_revenue = 0 for _ in range(int(input())): size, price = map(int, input().split()) if sizes_in_stock[size]: total_revenue += price sizes_in_stock[size] -= 1 print(total_revenue)
Feel free to ask if you have any questions :)
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 Python 3 solution from my HackerrankPractice repository:
Feel free to ask if you have any questions :)