How to determine is the string palindrome or not? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to determine is the string palindrome or not?

Describe the best algorithm you think (programming language no important, use words to describe algorithm steps).

16th Sep 2017, 9:19 PM
Маргарита Морозова
Маргарита Морозова - avatar
4 Answers
+ 1
some languages have a built in function to reverse a string but assuming you dont you could split the string up into single characters and use a for loop to go through them from last to worst to reconstruct the string backwards then check if its the same as the original string.
16th Sep 2017, 10:40 PM
Enzo
Enzo - avatar
27th Sep 2017, 3:48 PM
Маргарита Морозова
Маргарита Морозова - avatar
8th Dec 2017, 11:31 PM
Jonathan Álex
Jonathan Álex - avatar
9th Dec 2017, 11:33 AM
Jonathan Álex
Jonathan Álex - avatar