N monkeys are invited to a party where they start dancing. They dance in a circular formation, very similar to a Gujarati Garba or a Drum Circle. The dance requires the monkeys to constantly change positions after every 1 second. The change of position is not random & you, in the audience, observe a pattern. Monkeys are very disciplined & follow a specific pattern while dancing. Consider N = 6, and an array monkeys = {3,6,5,4,1,2}. This array (1-indexed) is the dancing pattern. The value at monkeys[i], indicates the new of position of the monkey who is standing at the ith position. Given N & the array monkeys[ ], find the time after which all monkeys are in the initial positions for the 1st time
Answers
Answered by
8
Nuclear power is the use of nuclear reactions that release nuclear energy to generate heat, which most frequently is then used in steam turbines to produce electricity in a nuclear power plant. Nuclear power can be obtained from nuclear
please mark me as brinliest dear .
please mark me as brinliest dear .
Answered by
2
Answer:
def position(num):
y=num
x=[0]*len(num)
count=0
while(x!=num):
count+=1
x=[0]*len(num)
for i in range(len(num)):
x[num[i]-1]=y[i]
y=x
return count
n=int(input())
for i in range(n):
number=int(input())
monkey=list(map(int,input().split()))
r=position(monkey)
print(r)
Step-by-step explanation:
Similar questions