Блог пользователя yesnomaybe

Автор yesnomaybe, история, 6 лет назад, По-английски

Given string S, and let K be the minimum number of rotations required to get the same string.

For Example: (1) For S = "aaaa", K = 1 (2) For S = "abcabc", K = 3 (3) For S = "abcdef", K = 6

Now my question is, can there be any string for which K > len(S)/2 and K < len(S) ? If not, can someone please help me prove it?

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

In your example (3), K is greater than len(S) / 2.

You asked the wrong question?

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by yesnomaybe (previous revision, new revision, compare).

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by yesnomaybe (previous revision, new revision, compare).

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Not possible, because K can only be divisor of N, and there is no such divisor greater than N/2 and less than N.