+ 1
Which algorithm can I use for finding the palindrome and reverse of a string?
2 Answers
+ 2
* For palindrome you can use a loop to check each character of the string from both sides (beginning & end) if any character was found different from each sides then it is not a palindrome string. If there is a character in the middle we can ignore it.
"abcdedcba" <= string
012345678 <= char index
* Compare the following:
char[0] with char[8],
char[1] with char[7]
char[2] with char[6],
char[3] with char[5]
char[4] is ignored (middle one)
For reversing a string you can see this amazing work, 8 ways to reverse a string:
https://code.sololearn.com/cfXMhtnzYC9e/?ref=app
+ 6
https://code.sololearn.com/Wjas7M7X2ZOG/?ref=app
you can look at this. You'll have find out!