UKG Interview Question

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