Company: Salesforce on campus Amts_24march
Difficulty: medium
In Salesforce, developers manage multiple types of licenses for different features. Each license type has a specific number of available slots, represented by an array licenseSlots , where licenseSlots[i] indicates the number of available slots for the i th license type. The goal is to distribute these licenses into 2 or more equal groups, such that number of each license slots is divisible by total number of groups. To achieve this, the administrator can add more slots to any license type as needed. Determine the minimum number of additional slots required to create at least 2 equal groups of licenses. Example n = 5 licenseSlots = [4, 7, 5, 11, 15] . To make 2 matching groups, the numbers of additional slots required are [0, 1, 1, 1, 1] . This sums to 4 additional slots. The numbers of slots become [4, 8, 6, 12, 16] , which can be evenly divided into 2 groups. If 3 groups are to be created, an additional [2, 2, 1, 1, 0] slots are needed, summing to 6 additional slots. This yields [6,