String Palindrome
abcdcba
true
public class Solution {
public static boolean isPalindrome(String str) {
int l =str.length();
String r="";
for(int i=0;i<l;i++)
{
char ch=str.charAt(i);
r=ch+r;
}
if(r.equals(str))
{
return true;
}
return false;
}
}
Comments
Post a Comment