Write a python function to compute minimum number of rotations required to get the same string


Topic: Write a python function to compute minimum number of rotations required to get the same string

Solution

def findRotations(str): 
    tmp = str + str
    n = len(str)   
    for i in range(1, n + 1): 
        substring = tmp[i: i+n] 
        if (str == substring): 
            return i 
    return n 
	
	
	



List all Python Programs