C# 2 Line Solution


  • 0
    L
    public bool IsPalindrome(string s) {
        var chars = s.Where(c => char.IsLetterOrDigit(c)).Select(c => char.ToUpper(c)).ToArray();
        return Enumerable.Range(0, chars.Length / 2).All(i => chars[i] == chars[chars.Length - 1 - i]);
    }

Log in to reply
 

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