-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.cs
More file actions
28 lines (22 loc) · 791 Bytes
/
Solution.cs
File metadata and controls
28 lines (22 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
namespace LeetCode.Problem1832{
//1832. Check if the Sentence Is Pangram
//https://leetcode.com/problems/check-if-the-sentence-is-pangram/
/*
A pangram is a sentence where every letter of the English alphabet appears at least once.
Given a string sentence containing only lowercase English letters, return true if sentence is a pangram, or false otherwise.
*/
public class Solution {
public bool CheckIfPangram(string sentence) {
Dictionary<char,int> word = new Dictionary<char,int>();
for (int i = 0; i < sentence.Length; i++)
{
var smb = sentence[i];
if (word.ContainsKey(smb))
word[smb]++;
else
word.Add(smb,1);
}
return word.Count == 26;
}
}
}