Hackathon at HackerRank HackerRank is organizing a hackathon for all its employees. A hackathon is a team event, and there are
n
teams taking part. The number of employees in the
i th team is denoted by teamSize[i]. In order to maintain uniformity, the team size of at most
k
teams can be reduced. Find the maximum number of teams of equal size that can be formed if team size is reduced optimally. Example There are
n=5
teams, team sizes are teamsize
=
[1,2,2,3,4]
, and the maximum number of teams whose size can be reduced,
k=2
. The team size of the last 2 teams can be reduced to 2 , thus teamSize
=[1,2,2,2,2]
. The maximum number of teams with equal size is 4. Function Description Complete the function equalizeTeamsize in the editor below. Returns int: the maximum number of equal size teams possible Constraints -
1≤n≤2∗10 5
-
1≤
teamSize
[i]≤10 9
-
0≤k≤10 9
Input Format For Custom Testing The first line contains an integer,
n
, denoting the number of elements in teamsize. Each line
i
of the
n
subsequent lines (where 0
≤i
) contains an integer describing teamSize [i]. The next line contains an integer,
k
, denoting the maximum number of teams possible which have equal size.