HackerRank 'Pangrams' Solution

Martin Kysel · April 13, 2015

Short Problem Definition:

Roy wanted to increase his typing speed for programming contests. So, his friend advised him to type the sentence “The quick brown fox jumps over the lazy dog” repeatedly, because it is a pangram. (Pangrams are sentences constructed by using every letter of the alphabet at least once.)



time complexity is O(N)

space complexity is O(N)


There are 26 letters in the English alphabet. A sentence is a pangram, if it contains all 26 characters.



def getCharCnt(s):
    return len(set(c.lower() for c in s if c != ' '))

if __name__ == '__main__':
    s = raw_input()
    if getCharCnt(s) == 26:
        print "pangram"
        print "not pangram"

Twitter, Facebook