palindrom | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

palindrom

how checj condition for palindrome

5th Dec 2016, 12:24 PM
Tindu
1 Answer
+ 2
There are several ways: 1) invert the order of the word/phrase, and check whether the result is identical to the original one. 2) traverse the word/phrase from the beginning and from the end at the same time, until you get to the middle. If the traversed characters are equal from the beginning and from the end, it's a palindrome.
5th Dec 2016, 4:43 PM
Álvaro