t=int(input())
for i in range(t):
n=int(input())
arr=list(map(int,input().split()))
d=[0]*100
for i in arr:
d[i]+=1
c=[0]*100
for j in d:
if(j!=0):
c[j]+=1
k=max(c)
print(c.index(k,0,len(c)))
Ah right! I tried the same thing yesterday but it was giving me a run time error. Another question would you recommend me using a dictionary over list for such a question?
When you make [0]*100, you are actually creating the same 0, 100 times. So if you change value at one index, that will change the value at each index, as they are the same objects.