My issue
can i covert the list in to set and return the len
My code
# cook your dish here
N=int(input())
for i in range(N):
x=int(input())
p=list(map(int,input().split()))
y=set(p)
print(len(y))
Problem Link: Largest K Practice Coding Problem
@vinaykumar2224
here plzz refer the following solution for better understanding
def main():
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
mp = {}
for num in a:
if num in mp:
mp[num] += 1
else:
mp[num] = 1
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()