My issue
Explain approach
My code
# cook your dish here
a=int(input(""))
for i in range(a):
b=(input(""))
for j in range(len(b)):
c=set(map(int,input("").split( )))
s=len(c)
if(s%int(b)==0):
print(b)
Problem Link: Largest K Practice Coding Problem
@sathishkodari
plzz refer the following code for better understanding of the logic
def main():
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
from collections import Counter
mp = Counter(a)
v = list(mp.values())
v.sort(reverse=True)
j = 0
sm = 0
ans = 0
for i in range(1, len(mp) + 1):
sm += v[j]
ch = sm % i
ans = max(ans, sm - ch)
j += 1
print(ans)
if __name__ == "__main__":
main()