Skip to content

Instantly share code, notes, and snippets.

@danielrobertson
Created September 22, 2015 01:44
Show Gist options
  • Save danielrobertson/59e36f111c82cb1cd25c to your computer and use it in GitHub Desktop.
Save danielrobertson/59e36f111c82cb1cd25c to your computer and use it in GitHub Desktop.
Return true if the string is palindrome, false otherwise
boolean isPalindrome(String s) {
for(int front = 0, end = s.length() - 1; front <= end; front++, end--) {
if(s.charAt(front) != s.charAt(end)) {
return false;
}
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment