Pangrams

  • + 0 comments

    C# solution

    public static string pangrams(string s)
    {
        var lowerString = s.ToLower();
        char[] characters = lowerString.ToCharArray().Where(e => !string.IsNullOrEmpty(e.ToString().Trim())).ToArray();
    
        var charList = new List<char>();
        foreach(var character in characters)
        {
            if(charList.Any(e => e == character))
                continue;
    
            charList.Add(character);
        }
    
        if(charList.Count == 26)
            return "pangram";
    
        return "not pangram";
    }