• + 0 comments

    My answer in Typescript, simple, not minimized

    function pangrams(s: string): string {
        /**
         * idea is simple
         * 1. create a set of unique character in [s]
         * 2. counting that set
         *      if count == 26 return 'pangram'
         *      if count != 26 return 'not pangram'
         * 
         * note: 26 is number of letter in alphabet (in same case lower/upper)
         */
    
        let _s = new Set<string>()
    
        for (let i = 0; i < s.length; i++) {
            if (s[i] == ' ') continue // i'm not counting spaces
            _s.add(s[i].toLowerCase())
        }
    
        return _s.size == 26 ? 'pangram' : 'not pangram'
    }