Answers for "check if palindrome recursion in c#"

C#
0

check if palindrome recursion in c#

public static bool IsPalindrome(string text)
    {
        if (text.Length <= 1)
            return true;
        else
        {
            if ( text[0] != text[ text.Length - 1 ] )
                return false;
            else
                return IsPalindrome( text.Substring( 1, text.Length-2 ) );
        }   
    }
Posted by: Guest on May-09-2021

Code answers related to "check if palindrome recursion in c#"

C# Answers by Framework

Browse Popular Code Answers by Language