Skip to content

Instantly share code, notes, and snippets.

@iwilbert
Created June 23, 2014 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iwilbert/77a2aa34ab66cdbbb4b5 to your computer and use it in GitHub Desktop.
Save iwilbert/77a2aa34ab66cdbbb4b5 to your computer and use it in GitHub Desktop.
public boolean isRotate(String s1, String s2) {
if(s1 == null || s2 == null || s1.isEmpty() || s2.isEmpty() || s1.length() != s2.length())
return false;
else
return isSubstring(s1+s1, s2);
}
private boolean isSubstring(String s1, String s2) {
return s1.contains(s2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment