1.2k views
0 votes
write a function ispalindrome(sentence) that returns true if the characters of the sentence string form a palindrome, false otherwise. a palindrome is a word or phrase that is that is the same forwards and backwards. examples: ispalindrome('rats live on no evil star'); //

User Mark Kram
by
4.0k points

1 Answer

4 votes

Answer: Solved using java but lmk if you want another language

Step-by-step explanation:

//Java

public class Palindrom{

public static boolean isPalindrome(String s){

String reverse = "";

for(int j = s.length() - 1; j>= 0; j--){

reverse+= s.charAt(j);

}

if(s.equals(reverse)){

return true;

}

return false
}
}

User Wendy Liga
by
3.5k points