UKG interview question

Code to determine if a string is a palindrome and explain your thought process.