I'm excited to showcase my coding journey on my blogspot. It's a deep dive into a multitude of programming languages, such as C, Java, Python, and beyond. I tackle challenging interview questions with thorough solutions. Come join me in exploring the world of programming!
def grov_monkey(r): z=r x=[0]*len(r) c = 0 while(x!=r): c+=1 x=[0]*len(r) for i in range(len(r)): x[r[i]-1]=z[i] z=x return (c) t=int(input()) for i in range(t): m,n=list(map(int,input().split())),int(input()) res=grov_monkey(m) print(res)
Comments
Post a Comment