0

Given a string, write a program to find the minimum number of rotations required to get the same string.

Example : Input : Hello Output : No. Rotation =5 I need to know if my code is valid https://www.sololearn.com/compiler-playground/c1hDfpLf1sd9 https://code.sololearn.com/c1hDfpLf1sd9/?ref=app

7th Apr 2023, 6:45 PM
Ghassan Sawalha
Ghassan Sawalha - avatar
3 odpowiedzi
+ 3
Your code doesn't work if we want to return to the beginning. It declares that the words aren't the same. If I change your input to (hi, hi) or, for example (solutions, solutions) it doesn't give 2 or 10. Which is actually the length of the string, and that could be a way to solve that.
8th Apr 2023, 12:41 PM
Ausgrindtube
Ausgrindtube - avatar
+ 7
Do you need help with a code? Please copy your code into a code bit in the code playground and attach it here. Someone can then see and advise you how to get the answer.
7th Apr 2023, 6:53 PM
Ausgrindtube
Ausgrindtube - avatar
+ 2
Your code seems true, what problem is you facing 🤔
8th Apr 2023, 12:34 AM
Hasnain [ACTIVE CHALLENGER]
Hasnain [ACTIVE CHALLENGER] - avatar