Created
January 30, 2019 18:01
-
-
Save harrisonbrock/02118e88d52d8e3b74fcfdeecee478bd 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 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