You are not logged in. Please login at to post your questions!


Codeforces-Hongcow learns the cyclic shift

I tried to solve This question by every time shifting the string until shifted string is not equal to the initial string and increment count variable every time. Is there any more optimum way to do this.

asked 20 Dec '16, 16:56

arpit728's gravatar image

accept rate: 10%

The optimum way to solve it would be using Set of strings and inserting all the shifts of the original string in that set till you reach initial string and finally print the size of the set.

You may also take a look at the editorials of that round : CodeForces Round #385 Editorial

Hope this helps :)


answered 20 Dec '16, 19:12

nikhil_chandak's gravatar image

accept rate: 23%

Yes, Optimum way is to use set. Here is my code...


answered 20 Dec '16, 21:56

mohitgarg2219's gravatar image

accept rate: 0%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 20 Dec '16, 16:56

question was seen: 807 times

last updated: 20 Dec '16, 21:56