abcyyyy's blog

By abcyyyy, history, 6 years ago, In English

How to solve a question where the string is first circularly rotated by 1 letter, then by 2 letter and soon , at what time the modified string will be equal to original string? these strings are made up using 'a' and 'b' only.

for eg: aabaab is the string on first letter rotation it will become abaaba on second rotation it will become aabaab so answer is 2.

I tried to solve this question but could only do this only by brute force. https://pasteboard.co/Hz1WUBx.jpg

Any help will be appreciated.

Full text and comments »

  • Vote: I like it
  • -18
  • Vote: I do not like it