Company: MediaNet_21july
Difficulty: medium
String Rotation Analysis Problem Description You are given an array A of N strings. Every string is made up of the letters 'a' and 'b' only. All the strings rotate together, driven by a shared clock that ticks at times t = 1, 2, 3, ... . At tick t , a string S of length L is circularly rotated to the back by t % L letters: the first t % L letters are removed from the front and appended, in order, to the end. If t % L is 0 , the string does not move on that tick. Rotations accumulate: the rotation at tick t is applied to the string as it stood after tick t - 1 , not to the original string. Process reset. As soon as a string becomes equal to its own original form, its process resets: from the very next tick it behaves exactly as it did at the start. So if a string first returns to its original form at time c , it is equal to its original form precisely at times c, 2c, 3c, ... . Each string resets on its own schedule; the strings never affect one another. Let f(t) be the number of strings