Company: KLA
Difficulty: medium
The Event A large outdoor concert has several entry checkpoints. Guests show up in groups, and each guest in the input list announces both how many companions they are bringing and which checkpoint their whole group will use. You are given two integer arrays of length n: friends : friends[i] is the number of companions traveling with the i-th guest listed. gates : gates[i] is the checkpoint number that guest and their companions pass through. Work out the total headcount that passes through each checkpoint. 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 giving the total headcount entering through each checkpoint Constraints 1 ≤ n, m ≤ 100000 1 ≤ friends[i] ≤ 1000 1 ≤ gate[i] ≤ m Example Input: friends = [1,