ex: ABCD -> CDAB or DABC
If str1 is the substring of str2 concatenated with itself(str2), then it is the rotation of it
boolean isRotation(String s1,String s2) {
return (s1.length() == s2.length()) && ((s1+s1).indexOf(s2) != -1);
}
ex: ABCD -> CDAB or DABC
If str1 is the substring of str2 concatenated with itself(str2), then it is the rotation of it
boolean isRotation(String s1,String s2) {
return (s1.length() == s2.length()) && ((s1+s1).indexOf(s2) != -1);
}