Created
September 22, 2015 01:44
-
-
Save danielrobertson/59e36f111c82cb1cd25c to your computer and use it in GitHub Desktop.
Return true if the string is palindrome, false otherwise
This file contains hidden or 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
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