Sogeti Interview Question

How would you write a program that takes a string and checks if it is a palindrome?

Interview Answer

Anonymous

Sep 26, 2017

First remove all non-letter char from the string. Then make sure that all the char in the string are all upper or lower case. Since a string is an array of char, create a variable and save the value of the array read forward, then a second variable of it read backwards. Compare the two variables and return true for palindrome if they equal, and false if they don't.