Company: KLA
Difficulty: medium
19. C++: The Event A major event is taking place at a mall with multiple entry gates. Attendees arrive with friends and specify the gate they will use. You have two integer arrays of length n: friends : Represents the number of friends each attendee is bringing. gates : Represents the gate each attendee will enter. Determine the total number of people entering through each gate. Function Description Complete the function getGatesCount with the following parameters: int friends[n] : friends[i] denotes the number of friends accompanying the i th attendee int gates[n] : gates[i] indicates the gate through which the i th attendee and their friends enter int m : the number of gates Returns int[m] : An array representing the total number of people entering from each gate Constraints 1 ≤ n, m ≤ 100000 1 ≤ friends[i] ≤ 1000 1 ≤ gate[i] ≤ m Example Input: friends = [1, 2, 3] gates = [1, 1, 2] m = 2 Output: [5, 4] For three attendees with two gates: The first attendee, with 1 friend, enters thro