Need some help to solve Minimum Rotations(string) problem.

Revision en4, by Newaj_69, 2017-10-22 19:14:01

I was trying to solve the problem http://www.spoj.com/problems/MINMOVE/ but unfortunately couldn't. My solution idea was:

1.First of all I checked whether all the character is same or not. If it is same then the answer is O. Example: aaa answer should be O.

2.Otherwise, I have concatenate the string at the back of the string and then added a "$" at last.

3.Then I build the suffix array (n*log(n)).

4.At last I traversed the suffix array whenever I got a value in the suffix array less then the string.size() then I printed the value.

Now, I have no idea what to do.Any help or suggestions would be appreciated.

code: https://ideone.com/QHcYhW

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en6 English Newaj_69 2017-10-22 19:15:54 2 Tiny change: 'ing.size() then I p' -> 'ing.size()/2 then I p'
en5 English Newaj_69 2017-10-22 19:15:07 4
en4 English Newaj_69 2017-10-22 19:14:01 13
en3 English Newaj_69 2017-10-22 19:12:23 6 Tiny change: 'ix array (O*Log(N)).\n\n4.A' -> 'ix array (n*log(n)).\n\n4.A'
en2 English Newaj_69 2017-10-22 19:10:59 14 Tiny change: 'idea is:\n1.First ' -> 'idea is:\n\n\n1.First ' (published)
en1 English Newaj_69 2017-10-22 19:08:52 717 Initial revision (saved to drafts)