Skip to content

Commit

Permalink
Detect Pangram
Browse files Browse the repository at this point in the history
  • Loading branch information
PheRum committed Jun 15, 2024
1 parent 5f3116b commit b2f21af
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion 6_kyu/Bit Counting/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { countBits } from "../../7_kyu/_example";
import { countBits } from "./index";

describe("Tests", () => {
it("example", () => {
Expand Down
7 changes: 7 additions & 0 deletions 6_kyu/Detect Pangram/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Detect Pangram

https://www.codewars.com/kata/545cedaa9943f7fe7b000048

A pangram is a sentence that contains every single letter of the alphabet at least once. For example, the sentence "The quick brown fox jumps over the lazy dog" is a pangram, because it uses the letters A-Z at least once (case is irrelevant).

Given a string, detect whether or not it is a pangram. Return True if it is, False if not. Ignore numbers and punctuation.
8 changes: 8 additions & 0 deletions 6_kyu/Detect Pangram/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { isPangram } from "./index";

describe("Tests", () => {
it("example", () => {
expect(isPangram("The quick brown fox jumps over the lazy dog.")).toBe(true);
expect(isPangram("This is not a pangram.")).toBe(false);
});
});
5 changes: 5 additions & 0 deletions 6_kyu/Detect Pangram/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export function isPangram(phrase: string): boolean {
const alphabets = "abcdefghijklmnopqrstuvwxyz".split("");
phrase = phrase.toLowerCase();
return alphabets.every((x) => phrase.includes(x));
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

### Katas solved

`Total`: 107 \
`Total`: 108 \
`8_kyu`: 87 \
`7_kyu`: 14 \
`6_kyu`: 6 \
`6_kyu`: 7 \
`5_kyu`: 0 \
`4_kyu`: 0 \
`3_kyu`: 0 \
Expand Down

0 comments on commit b2f21af

Please sign in to comment.