判断回文递归算法实现
static bool IsPalindrome(string s)
{
if (num >= s.Length - num - 1)
{
return true;
}
else if (s[num] == s[s.Length - num - 1])
{
num++; // 全局变量
IsPalindrome(s);
return true;
}
else
{
return false;
}
}
static bool IsPalindrome(string s)
{
if (num >= s.Length - num - 1)
{
return true;
}
else if (s[num] == s[s.Length - num - 1])
{
num++; // 全局变量
IsPalindrome(s);
return true;
}
else
{
return false;
}
}