This is simple in-degree counting problem. I decided to use Python 3 for this question due to the split method available in strings.
Code
Language:Python 3t=int(input())
while t!=0:
li =[]
t=t-1
n=int(input())
mini=n
li=list()
for i in range (n):
stri=input()
nos=len(stri.strip().split(" "))
#print ("Got ", nos)
if nos < mini:
mini=nos
li=list()
li.append(i+1)
elif nos == mini:
li.append(i+1)
print(*li, sep=' ')
if t!=0:
input()
Comments
Post a Comment