Skip to content

Instantly share code, notes, and snippets.

@harrisonbrock
Created January 30, 2019 18:01
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 harrisonbrock/02118e88d52d8e3b74fcfdeecee478bd to your computer and use it in GitHub Desktop.
Save harrisonbrock/02118e88d52d8e3b74fcfdeecee478bd to your computer and use it in GitHub Desktop.
public boolean isPalindrome(String word) {
// create two index start and end
for (int start = 0, end = word.length() - 1; start < end; ++start, --end){
// check if the two values are not the same
if(word.charAt(start) != word.charAt(end)) return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment