You are not logged in. Please login at www.codechef.com 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

1★arpit728
6831765
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 :)

link

answered 20 Dec '16, 19:12

nikhil_chandak's gravatar image

5★nikhil_chandak
3712
accept rate: 23%

Yes, Optimum way is to use set. Here is my code... http://codeforces.com/contest/745/submission/23067814

link

answered 20 Dec '16, 21:56

mohitgarg2219's gravatar image

3★mohitgarg2219
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×643
×2

question asked: 20 Dec '16, 16:56

question was seen: 807 times

last updated: 20 Dec '16, 21:56