-
-
Save priort/274eacf49bf11a0ba89fccc323072734 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 Palindrome { | |
public static boolean isPalindrome(String str) { | |
int strEndIndex = str.length() - 1; | |
for(int i = strEndIndex; i > (strEndIndex/2); i--) | |
if(str.charAt(i) != str.charAt(strEndIndex - i)) | |
return false; | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment