Company: Salesforce on campus Amts_24march

Difficulty: medium

Problem Statement

A CRM platform's administrators manage several license types, each with its own pool of available slots, given as an array licenseSlots where licenseSlots[i] is the slot count for the i th license type. The administrator wants to split these slots into 2 or more equally-sized groups, meaning each license type's slot count must be evenly divisible by however many groups are chosen. Slots can be added (never removed) to any license type to make this possible. Work out the smallest total number of slots that must be added so that at least one valid grouping into 2 or more equal groups exists. 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, 9, 6, 12, 15]

More Salesforce on campus Amts_24march OA questionsInterview experiences