diff --git a/6_kyu/Bit Counting/index.test.ts b/6_kyu/Bit Counting/index.test.ts index 82837cb..63080a4 100644 --- a/6_kyu/Bit Counting/index.test.ts +++ b/6_kyu/Bit Counting/index.test.ts @@ -1,4 +1,4 @@ -import { countBits } from "../../7_kyu/_example"; +import { countBits } from "./index"; describe("Tests", () => { it("example", () => { diff --git a/6_kyu/Detect Pangram/README.md b/6_kyu/Detect Pangram/README.md new file mode 100644 index 0000000..7ce688b --- /dev/null +++ b/6_kyu/Detect Pangram/README.md @@ -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. diff --git a/6_kyu/Detect Pangram/index.test.ts b/6_kyu/Detect Pangram/index.test.ts new file mode 100644 index 0000000..f2bac46 --- /dev/null +++ b/6_kyu/Detect Pangram/index.test.ts @@ -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); + }); +}); diff --git a/6_kyu/Detect Pangram/index.ts b/6_kyu/Detect Pangram/index.ts new file mode 100644 index 0000000..ac26b8c --- /dev/null +++ b/6_kyu/Detect Pangram/index.ts @@ -0,0 +1,5 @@ +export function isPangram(phrase: string): boolean { + const alphabets = "abcdefghijklmnopqrstuvwxyz".split(""); + phrase = phrase.toLowerCase(); + return alphabets.every((x) => phrase.includes(x)); +} diff --git a/README.md b/README.md index cb2d3f2..33d8784 100644 --- a/README.md +++ b/README.md @@ -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 \