I tried solving this problem in SPOJ using Booth Algorithm in O(n) time, but it failed though it worked for all test cases I tried.
Then I did in Brute force way in O(n^2) time, it worked. I have attached the code for both the cases, tell me where I went wrong or is Booth algo a correct approach for this problem?
Isnt the problem, finding the minimum rotation for Lexicographically smallest string
For first approach, Booth Algorithm : http://ideone.com/J5gl5
For second approach, Brute Force : http://ideone.com/ofTeA