Created
December 15, 2015 05:08
-
-
Save SIRHAMY/723ba939652abba2d53d to your computer and use it in GitHub Desktop.
Java: Decides if given string is a Palindrome
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
public boolean isPalindrome(String s) { | |
for(int i = 0; i < s.length()/2; i++) { | |
if(s.charAt(i) != s.charAt(s.length() - i - 1)) { | |
return false; | |
} | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment