Skip to content

Commit 63b82fd

Browse files
committed
Hashing: Check if the Sentence Is Pangram
1 parent d46197f commit 63b82fd

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export function checkIfPangram(sentence: string): boolean {
2+
const ALPHABET_SIZE = 26;
3+
4+
const uniqueLetters = new Set(sentence);
5+
6+
return uniqueLetters.size === ALPHABET_SIZE;
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { checkIfPangram } from '@/hashing/check-if-the-sentence-is-pangram.js';
2+
3+
describe('Hashing: Check if the Sentence Is Pangram', () => {
4+
test.each([
5+
{
6+
sentence: 'thequickbrownfoxjumpsoverthelazydog',
7+
output: true,
8+
},
9+
{ sentence: 'leetcode', output: false },
10+
])('checkIfPangram($sentence) === $output', ({ sentence, output }) => {
11+
expect(checkIfPangram(sentence)).toStrictEqual(output);
12+
});
13+
});

0 commit comments

Comments
 (0)