Check if one string is Rotation of another string
Objective: Write an algorithm to check if one string is Rotation of another string. This question has been asked in the Amazon interview.
Input Strings : 'sumitjain' and 'tjainsumi' Output : true Input String : 'Jaain' and 'ainJ' Output: false
Input: Two Strings
Output: True or false based on whether strings are rotation of each other.
- Make a new String by appending the appending the first string with itself
- Check if second string is sub string of new String
Is 'sumitjain' and 'tjainsumi' are rotated?? : true
Top Companies Interview Questions..-
If you find anything incorrect or you feel that there is any better approach to solve the above problem, please write comment.