BETA

Difficulty Level: Medium

Submissions: 1300 Accuracy:

31.15%

Count Element Occurences (Function Problem)
     

Given an array of size n, find all elements in array that appear more than n/k times.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer n denoting the size of the array. Then the next line contains n space separated integers forming the array. The last line of input contains an integer k.

Output:
Print the count of elements in array that appear more than n/k times.

Constraints:
1<=T<=10^5
1<=N<=10^5
1<=a[i]<=10^5
1<=k<=N

Example:
Input:

2
8
3 1 2 2 1 2 3 3
4
4
2 3 3 2
3

Output:
2
2

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ayush Govil


					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.