diff --git a/src/merginIntervals.test.ts b/src/merginIntervals.test.ts deleted file mode 100644 index deb2fbe..0000000 --- a/src/merginIntervals.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { describe, expect, test } from "@jest/globals"; - -describe("merginIntervals", () => { - const isPrime = (number: number) => { - if (number <= 1) return false; - if (number <= 3) return true; - return Array.from({ length: number - 2 }).every((_, index) => { - const divider = index + 2; - if (number % divider === 0) { - return false; - } - return true; - }); - }; - - test("no arg", async () => { - expect(isPrime(0)).toBe(false); - // expect(isPrime(1)).toBe(false); - // expect(isPrime(2)).toBe(true); - // expect(isPrime(3)).toBe(true); - // expect(isPrime(23)).toBe(true); - // expect(isPrime(22)).toBe(false); - // expect(isPrime(21)).toBe(false); - }); -}); diff --git a/src/pal.test.ts b/src/pal.test.ts deleted file mode 100644 index 8084bff..0000000 --- a/src/pal.test.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { describe, expect, test } from "@jest/globals"; - -describe("validPalindrome", () => { - function validPalindrome(s: string, MAX_DIFFS = 1): boolean { - const isPalindrome = (sub: string, depth = 0): boolean => { - if (depth > 0) console.log(sub); - let leftPointer = 0; - let rightPointer = sub.length - 1; - - while (leftPointer < rightPointer) { - const leftChar = sub[leftPointer]; - const rightChar = sub[rightPointer]; - if (leftChar !== rightChar) - return depth < MAX_DIFFS - ? isPalindrome(sub.slice(leftPointer, rightPointer), depth + 1) || - isPalindrome( - sub.slice(leftPointer + 1, rightPointer + 1), - depth + 1 - ) - : false; - - leftPointer++; - rightPointer--; - } - - return true; - }; - - return isPalindrome(s); - } - - test("no arg", async () => { - expect(validPalindrome("12", 0)).toBe(true); - }); -});