0
Palindrome error
I have written logic for palindrome, by splitting the word in char array and comparing them. But the if condition is failing again and again Refer line no 70 input : string type https://code.sololearn.com/cw9Fl0731H0x/?ref=app
5 Réponses
+ 5
To convert in char array do this. Then it will work fine.
char []s=word.toCharArray();
+ 3
Store the character array in reverse order in a string variable and compare it with input using the equals method.
+ 2
Shariff We can solve any problem in many ways. And I think we are at Good plateform. Different people gives different and correct answer. We can learn so many things here.
+ 1
if (! s[i].equals(s[s.length-1-i]) ){