Skip to content

Instantly share code, notes, and snippets.

@jaideepjagyasi
Last active November 14, 2019 02:37
Show Gist options
  • Save jaideepjagyasi/50744dd51ea8694542ade2d658796fe3 to your computer and use it in GitHub Desktop.
Save jaideepjagyasi/50744dd51ea8694542ade2d658796fe3 to your computer and use it in GitHub Desktop.
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