C# Solution with Linq


  • 0
    N
    public class Solution
    {
        public bool IsPalindrome(string s)
        {
            return s == String.Empty ? true : String.Compare(String.Join(String.Empty, s.Where(x => Char.IsLetterOrDigit(x))), String.Join(String.Empty, s.Where(x => Char.IsLetterOrDigit(x)).Reverse().ToArray()), true) == 0;
        }
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.