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

Правка en5, от Newaj_69, 2017-10-22 19:15:07

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 0. Example: aaa answer should be 0.

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

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en6 Английский Newaj_69 2017-10-22 19:15:54 2 Tiny change: 'ing.size() then I p' -> 'ing.size()/2 then I p'
en5 Английский Newaj_69 2017-10-22 19:15:07 4
en4 Английский Newaj_69 2017-10-22 19:14:01 13
en3 Английский 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 Английский Newaj_69 2017-10-22 19:10:59 14 Tiny change: 'idea is:\n1.First ' -> 'idea is:\n\n\n1.First ' (published)
en1 Английский Newaj_69 2017-10-22 19:08:52 717 Initial revision (saved to drafts)