Skip to content

Instantly share code, notes, and snippets.

@priort
Created December 30, 2018 12:37
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 priort/274eacf49bf11a0ba89fccc323072734 to your computer and use it in GitHub Desktop.
Save priort/274eacf49bf11a0ba89fccc323072734 to your computer and use it in GitHub Desktop.
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