garden game what's wrong with my algorithm

for every bandit i determine the no of steps it takes to come back to the same i and multiply this with a running multipler variable(i.e no of whistle) for next I determine the gcd(no of steps of i,multipler variable)
divide the no of steps I with obtained gcd and multiply this with multipler variable…
tested exhaustively for all permutations of 15 and they are working…

This approach is incorrect because you need the LCM (1e9 + 7). Continuing with your approach would require nasty modifications to handle inverse operations etc.

There is a much cleaner and simple to understand approach given in editorial.