Last active
November 14, 2019 02:37
-
-
Save jaideepjagyasi/50744dd51ea8694542ade2d658796fe3 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 str){ | |
boolean result=false; | |
if(str!=null && !str.equals("")){ | |
int i=0; | |
int j=str.length()-1; | |
while(i<j){ | |
if(str.charAt(i)!=str.charAt(j){ | |
break; | |
} | |
i++; | |
j--; | |
} | |
if(i==j || i==j+1) | |
result=true; | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment