C++ Algorithmically Simple Recursive Palindrome Checker

Check this:

int is_pal(int start, int end, string &str)
{
    if (start >= end)
        return 1;
    if (str[start] != str[end])
        return 0;
    return is_pal(++start, --end, str);   
}

Call the method from main. Let me know if that helps.. 🙂

Leave a Comment

tech