Algorithm · Expedia · Medium
A trading card company packs sports cards into identical packets, one type per packet. You are given the current inventory counts as an integer array cardTypes, where cardTypes[i] is the number of cards of type i. Find the smallest total number of extra cards you must add so that there exists an integer p >= 2 with the following property: after the additions, the count of every card type is a multiple of p. In other words, after adding cards, each card type can be split…
Checking your access…