문제를 이해하고 있다면 바로 풀이를 보면 됨
전체 코드로 바로 넘어가도 됨
마음대로 번역해서 오역이 있을 수 있음
팬그램은 영어 알파벳의 모든 글자가 적어도 한번씩 등장하는 문장이다.
오직 영어 소문자로 구성된 문자열 sentence가 주어졌을 때, sentence가 팬그램이면 true, 그렇지 않으면 false를 반환해라.
#1
Input: sentence = "thequickbrownfoxjumpsoverthelazydog"
Output: true
Explanation: sentence는 영어 알파벳의 모든 문자를 하나씩 포함한다.
#2
Input: sentence = "leetcode"
Output: false
class Solution {
public boolean checkIfPangram(String sentence) {
if(sentence.length() < 26){
return false;
}
boolean[] alphabet = new boolean[26];
for(char c : sentence.toCharArray()){
if(c >= 'a' && c <= 'z'){
alphabet[c - 'a'] = true;
}
}
for(boolean flag : alphabet){
if(!flag){
return false;
}
}
return true;
}
}