Post

leetcode(리트코드)-1832 Check if the Sentence Is Pangram(python)

leetcode 1832 - Check if the Sentence Is Pangram 문제입니다.

1. 문제

https://leetcode.com/problems/check-if-the-sentence-is-pangram/


2. Input , Output


3. 분류 및 난이도

Eazy 난이도 문제입니다.


4. 문제 해석

  • pangram이란, sentence로 주어진 문자열에 모든 소문자 영어 알파벳이 한 번 이상 나오면 True이고 아니면 False인 문자열을 말합니다.
  • pangram를 판단하세요.

5. code

코드설명

python

1
2
3
4
5
6
7
8
9
class Solution:
    def checkIfPangram(self, sentence: str) -> bool:
        dic = {}
        for word in sentence:
            if word not in dic :
                 dic[word] = 1
                 if len(dic) == 26 :
                    return True
        return False

6. 결과 및 후기, 개선점

필요시 c++로 짜드리겠습니다.

This post is licensed under CC BY 4.0 by the author.