Created
June 13, 2015 03:10
-
-
Save thmain/3aa6dbfb5ef75840948f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RotatedArray { | |
public boolean isRotated(String s1, String s2){ | |
if(s1.length()!=s2.length()){ | |
return false; | |
} | |
String sAdd = s1 + s1; | |
if(sAdd.contains(s2)){ | |
return true; | |
}else{ | |
return false; | |
} | |
} | |
public static void main(String arg[]){ | |
String s1 = "sumitjain"; | |
String s2 = "tjainsumi"; | |
RotatedArray r = new RotatedArray(); | |
System.out.println("Is '" + s1 + "' and '" + s2 + "' are rotated?? : " + r.isRotated(s1, s2)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment