Sort by

recency

|

1950 Discussions

|

  • + 0 comments

    Fastest Solution:

    #include <iostream>
    using namespace std;
    
    bool is_pangram(const string& str) {
        int mask = 0; 
        for(const char c : str) {
            if(islower(c)) mask |= 1 << (c - 'a'); 
            else if(isupper(c)) mask |= 1 << (c - 'A'); 
        }
    
        return mask == (1 << 26) - 1; 
    }
    
    int main() {
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    
        string str; 
        getline(cin, str); 
    
        cout << (is_pangram(str)? "pangram" : "not pangram") << endl; 
        return 0; 
    }
    
  • + 0 comments

    def pangrams(s):

    lo = s.lower()
    count = []
    sl = ["a","b","c","d","e","f","g","h","i","j","k","l",
    "m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
    
    for i in lo:
        if i in sl:
            count.append(i)
    
    n = set(count)
    print(n)
    
    if len(n) == 26:
        return('pangram')
    else:
        return('not pangram')
    
  • + 0 comments

    Here is problem solution in python, java, c++, c and javascript programming - https://programmingoneonone.com/hackerrank-pangrams-problem-solution.html

  • + 0 comments

    My solution in kotlin covering all the test cases

    fun pangrams(s: String): String {
        
        
        val target = "abcdefghijklmnopqrstuvwxyz"
        val input = s.lowercase()
        
        for(ch in target) {
            if(!input.contains(ch)) 
                return "not pangram"
        }
        
        return "pangram"
    
    }
    
  • + 0 comments

    For Python3 Platform

    I wrote the code from scratch just to get more practice

    def pangrams(s):
        s = set(s.lower().replace(" ", ""))
        
        if(len(s) == 26):
            return "pangram"
        else:
            return "not pangram"
    
    s = input()
    
    result = pangrams(s)
    
    print(result)