Check if Two Strings are Rotation of Each Other
Given two strings, "string1" and "string2" our task is to check that string2 is
a rotation of string1.
For example:
Input: string1 = "awesomepython" string2 = "pythonawesome"
Output: "Yes"
The basic method of solving this problem is to concatenate one string with
itself then check if another string is a substring of a concatenated string.
Thank you so much for reading this article, if you like this question please share this with your friends who love programming. And if you have questions or feedback please drop a comment.
To solve more problems, check out this article "Top 10 String Interview Questions".
All the Best!
Comments
Post a Comment