In a forest, each rabbit has some color. Some subset of rabbits (possibly all of them) tell you how many other rabbits have the same color as them. Those answers are placed in an array/list named ‘ANSWERS.’
Return the minimum number of rabbits that could be in the forest.
For Example :
Given:-
‘N’ = 3, ‘ANSWERS’ = [2,2,2]

There are a total of 3 rabbits because each of the ‘ANSWERS[i]’ tells that there are two more rabbits just like them with the same color.
Input Format :
The first line of input contains an integer ‘T’ denoting the number of test cases.
The first line of each test case contains a single integer, ‘N’, where ‘N’ is the number of elements of the array.
The second line of each test case contains ‘N’ space-separated integers, denoting the elements of 'ANSWERS'.
Output Format :
For each test case, print an integer denoting the total number of rabbits.
The output of each test case will be printed in a separate line.
Note :
You don’t need to print anything, it has already been taken care of. Just implement the given function.
Constraints :
1 <= T <= 5
1 <= N <= 5000
1 <= ANSWERS[i] < 1000
Where ‘ANSWERS’[i] is the array element at index ‘i’.
Time limit: 1 sec
2
3
2 2 2
4
0 1 1 0
3
4
For the first test case:

There are a total of 3 rabbits because each of the ‘ANSWERS[i]’ tells that there are two more rabbits just like them with the same color.
For the second test case:

'ANSWERS[0]' and 'ANSWERS[3]' indicate that there exist two rabbits rabbit 1 and rabbit 4 which don't have the same color as any other rabbit. So, there are at least two rabbits.
Now rabbit 2 and rabbit 3 tell that there is one more rabbit precisely like them (as indicated by 'ANSWERS[1]' and 'ANSWERS[2]').
Therefore, they can be of the same color.
2
3
1 1 2
4
1 1 2 2
5
5
Can we use a hash map?
The main idea is that if ‘X’ + 1 rabbits have the same color, then we get ‘X’ + 1 rabbits who all answer ‘X’ i.e ‘ANSWERS[i]’ = ‘X’ for ‘X’ + 1 rabbits. Now ‘N’ rabbits answer ‘X.’
Thus, the number of groups is ceil(‘N’ / (‘X’ + 1)).
Algorithm:
O(N), where ‘N’ is the length of the given array/list ‘ANSWERS’.
We have to traverse the array completely. Therefore, net time complexity will be O(N).
O(N), where ‘N’ is the length of the given array/list ‘ANSWERS’.
Since we are using a map to keep track of the elements.