Sort by

recency

|

1917 Discussions

|

  • + 0 comments

    function pangrams(s) { // Write your code here return new Set(s.toLowerCase().replaceAll(" ", "").split('')).size === 26 ? "pangram" : "not pangram" }

  • + 0 comments

    Here is my c++ solution, you can watch the explanation here : https://youtu.be/-8w6U6qPNrA

    #include <bits/stdc++.h>
    
    using namespace std;
    
    int main()
    {
        string s;
        getline(cin, s);
        vector<int> c(26, 0);
        for(int i = 0; i < s.size(); i++){
            if(s[i] != ' ')
            c[tolower(s[i]) - 'a']++;
        }
        string r = "pangram";
        for(int i = 0; i < c.size(); i++){
            if(c[i] == 0){
                r = "not " + r;
                break;
            }
        }
        cout << r ;
        return 0;
    }
    
  • + 0 comments

    Trying out pangrams is always a fun way to challenge your brain! And if you’re ever in Melbourne and craving a delicious treat, you can't go wrong with a gluten-free birthday cake. There's something so special about celebrating with a cake that everyone can enjoy, no matter their dietary needs!

  • + 0 comments

    My JS solution with ASCII char code approach

    const pangrams = s => {
        const string = s.toLowerCase().replace(/ /g, "");
        const charCodeArr = [...new Set([...string].map((_, i) => string.charCodeAt(i)))].sort((a, b) => a - b);
        
        for (let i = 97; i <= 122; i++) {
            if (!charCodeArr.includes(i)) return "not pangram";
        }
        return "pangram";
    }
    
  • + 0 comments

    Here's my Javascript / Typescript solution (Thank you ES6+)

    const ABC = "abcdefghijklmnopqrstuvwxyz".split("");
    function pangrams(s: string): string {
        const incomingString = s.toLowerCase().split("");
        const allMatches = ABC.every(letter => incomingString.includes(letter))
        return allMatches ? "pangram" : "not pangram";
    }