This post is completed by 2 users
|
Add to List |
26. Check if one string is Rotation of another string
Objective: Write an algorithm to check if one string is Rotation of another string.
Example:
Input Strings : 'tutorialhorizon' and 'horizontutorial' Output : true Input String : 'horizontutorial' and 'horizonrial' Output: false
Approach:
- Make a new String by appending the appending the first string with itself
- Check if second string is sub string of the first string
Output:
Is 'tutorialhorizon' and 'horizontutorial' are rotated?? : true