diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..7ee4cf2 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +node_modules +docs \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json index 5df65dd..f65e115 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,21 @@ { - "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], + "root": true, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended" + ], + "plugins": [ + "@typescript-eslint", + "jest", + "simple-import-sort", + "unused-imports" + ], "parser": "@typescript-eslint/parser", - "plugins": ["@typescript-eslint", "jest"], - "root": true + "rules": { + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": "error", + "unused-imports/no-unused-imports": "error", + "simple-import-sort/exports": "error" + } } diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..7ee4cf2 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +node_modules +docs \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json index e74ed9f..fb17ebe 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,6 +1,7 @@ { "trailingComma": "es5", "tabWidth": 4, - "semi": false, - "singleQuote": true + "semi": true, + "singleQuote": true, + "endOfLine": "crlf" } diff --git a/jest.config.ts b/jest.config.ts index bf8b4b8..4996c46 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -1,5 +1,5 @@ -import { JestConfigWithTsJest, pathsToModuleNameMapper } from 'ts-jest' -import { compilerOptions } from './tsconfig.json' +import { JestConfigWithTsJest, pathsToModuleNameMapper } from 'ts-jest'; +import { compilerOptions } from './tsconfig.json'; const jestConfig: JestConfigWithTsJest = { preset: 'ts-jest/presets/default-esm', @@ -9,6 +9,6 @@ const jestConfig: JestConfigWithTsJest = { roots: [''], modulePaths: [compilerOptions.baseUrl], moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths), -} +}; -export default jestConfig +export default jestConfig; diff --git a/package.json b/package.json index a241e62..270c82b 100644 --- a/package.json +++ b/package.json @@ -15,26 +15,41 @@ "type": "module", "scripts": { "test": "jest", - "doc": "typedoc --entryPointStrategy expand ./src --exclude \"./src/**/*+(test).ts\" --excludeReferences", - "lint": "eslint .", - "format": "prettier . --write" + "doc": "typedoc", + "trunk:check": "trunk check --all", + "trunk:fix": "trunk check --all --fix", + "trunk:format": "trunk fmt", + "type:check": "tsc --project tsconfig.json" }, "devDependencies": { + "@trunkio/launcher": "^1.3.1", "@types/jest": "^29.5.11", "@types/node": "^20.10.8", "@typescript-eslint/eslint-plugin": "^6.18.1", "@typescript-eslint/parser": "^6.18.1", "@yarnpkg/sdks": "^3.1.0", "eslint": "^8.56.0", + "eslint-config-prettier": "^9.1.0", + "eslint-import-resolver-typescript": "^3.6.3", "eslint-plugin-jest": "^28.2.0", + "eslint-plugin-prettier": "^5.2.1", + "eslint-plugin-simple-import-sort": "^12.1.1", + "eslint-plugin-unused-imports": "^4.1.3", "jest": "^29.7.0", "prettier": "^3.2.5", "ts-jest": "^29.1.1", - "typedoc": "^0.25.7" + "typedoc": "^0.25.13", + "typedoc-plugin-rename-defaults": "^0.7.0", + "typedoc-theme-hierarchy": "^4.1.2" }, "dependencies": { "ts-node": "^10.9.2", "typescript": "^5.3.3" }, + "resolutions": { + "@babel/traverse": "7.23.2", + "braces": "3.0.3", + "micromatch": "4.0.8" + }, "packageManager": "yarn@4.1.1" } diff --git a/src/Problem Solving/Algorithms/Implementation/Angry Professor/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Angry Professor/index.test.ts index 0273104..fa92bf5 100644 --- a/src/Problem Solving/Algorithms/Implementation/Angry Professor/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Angry Professor/index.test.ts @@ -1,5 +1,5 @@ -import { angryProfessor } from '@ProblemSolving/Algorithms/Implementation' +import { angryProfessor } from '@ProblemSolving/Algorithms/Implementation'; test('should return whether the class is cancelled or not', () => { - expect(angryProfessor(3, [-1, -3, 4, 2])).toBe('YES') -}) + expect(angryProfessor(3, [-1, -3, 4, 2])).toBe('YES'); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Angry Professor/index.ts b/src/Problem Solving/Algorithms/Implementation/Angry Professor/index.ts index ccea7f6..3c94efa 100644 --- a/src/Problem Solving/Algorithms/Implementation/Angry Professor/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Angry Professor/index.ts @@ -1,13 +1,23 @@ /** - * Determines if the class is cancelled. - * @author Andrew Mamdouh + * A Discrete Mathematics professor has a class of students. + * Frustrated with their lack of discipline, the professor decides to cancel class if fewer than some number of students are present when class starts. + * Arrival times go from on time `arrivalTime <= 0` to arrived late `arrivalTime > 0`. + * + * Given the arrival time of each student and a threshold number of attendees, determine if the class is cancelled. + * * @param {number} k - The threshold number of students * @param {number[]} a - The arrival times of the students * @returns {"YES" | "NO"} Whether the class is cancelled or not. + * @example + * ```ts + * const result = angryProfessor(3, [-1, -3, 4, 2]); + * console.log(result); // "YES" + * ``` + * @author Andrew Mamdouh */ const angryProfessor = (k: number, a: number[]): string => { - const students = a.filter((time) => time <= 0).length - return students < k ? 'YES' : 'NO' -} + const students = a.filter((time) => time <= 0).length; + return students < k ? 'YES' : 'NO'; +}; -export default angryProfessor +export default angryProfessor; diff --git a/src/Problem Solving/Algorithms/Implementation/Append and Delete/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Append and Delete/index.test.ts index 4565a8d..52d0440 100644 --- a/src/Problem Solving/Algorithms/Implementation/Append and Delete/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Append and Delete/index.test.ts @@ -1,5 +1,5 @@ -import { appendAndDelete } from '@ProblemSolving/Algorithms/Implementation' +import { appendAndDelete } from '@ProblemSolving/Algorithms/Implementation'; test('should return "Yes" or "No"', () => { - expect(appendAndDelete('hackerhappy', 'hackerrank', 9)).toBe('Yes') -}) + expect(appendAndDelete('hackerhappy', 'hackerrank', 9)).toBe('Yes'); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Append and Delete/index.ts b/src/Problem Solving/Algorithms/Implementation/Append and Delete/index.ts index caee110..409b11e 100644 --- a/src/Problem Solving/Algorithms/Implementation/Append and Delete/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Append and Delete/index.ts @@ -1,4 +1,4 @@ -import { getLongestCommonSubStr } from '@Helpers' +import { getLongestCommonSubStr } from '@Helpers'; /** * Determines whether you can convert (s) to (t) by performing exactly (k) of operations * @author Andrew Mamdouh @@ -8,14 +8,14 @@ import { getLongestCommonSubStr } from '@Helpers' * @returns {"Yes" | "No"} Whether this can be performed or not */ const appendAndDelete = (s: string, t: string, k: number): 'Yes' | 'No' => { - let longestCommonStr = getLongestCommonSubStr(s, t) - if (s.indexOf(longestCommonStr) !== 0) longestCommonStr = '' - const maxOpsNum = s.length + t.length + let longestCommonStr = getLongestCommonSubStr(s, t); + if (s.indexOf(longestCommonStr) !== 0) longestCommonStr = ''; + const maxOpsNum = s.length + t.length; return (maxOpsNum - longestCommonStr.length * 2 <= k && (maxOpsNum - longestCommonStr.length * 2) % 2 === k % 2) || maxOpsNum <= k ? 'Yes' - : 'No' -} + : 'No'; +}; -export default appendAndDelete +export default appendAndDelete; diff --git a/src/Problem Solving/Algorithms/Implementation/Apple and Orange/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Apple and Orange/index.test.ts index caf039f..935330f 100644 --- a/src/Problem Solving/Algorithms/Implementation/Apple and Orange/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Apple and Orange/index.test.ts @@ -1,7 +1,7 @@ -import { countApplesAndOranges } from '@ProblemSolving/Algorithms/Implementation' +import { countApplesAndOranges } from '@ProblemSolving/Algorithms/Implementation'; test("should return the number of apples and oranges that fall on Sam's house", () => { expect(countApplesAndOranges(7, 11, 5, 15, [-2, 2, 1], [5, -6])).toEqual([ 1, 1, - ]) -}) + ]); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Apple and Orange/index.ts b/src/Problem Solving/Algorithms/Implementation/Apple and Orange/index.ts index 5cd45d0..b41c2ab 100644 --- a/src/Problem Solving/Algorithms/Implementation/Apple and Orange/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Apple and Orange/index.ts @@ -26,7 +26,7 @@ const countApplesAndOranges = ( (acc, cur) => (acc += b + cur >= s && b + cur <= t ? 1 : 0), 0 ), - ] -} + ]; +}; -export default countApplesAndOranges +export default countApplesAndOranges; diff --git a/src/Problem Solving/Algorithms/Implementation/Beautiful Days at the Movies/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Beautiful Days at the Movies/index.test.ts index a7585c8..7dba503 100644 --- a/src/Problem Solving/Algorithms/Implementation/Beautiful Days at the Movies/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Beautiful Days at the Movies/index.test.ts @@ -1,5 +1,5 @@ -import { beautifulDays } from '@ProblemSolving/Algorithms/Implementation' +import { beautifulDays } from '@ProblemSolving/Algorithms/Implementation'; test('should return the number of beautiful days', () => { - expect(beautifulDays(20, 23, 6)).toBe(2) -}) + expect(beautifulDays(20, 23, 6)).toBe(2); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Beautiful Days at the Movies/index.ts b/src/Problem Solving/Algorithms/Implementation/Beautiful Days at the Movies/index.ts index b71ffe2..6e67a6c 100644 --- a/src/Problem Solving/Algorithms/Implementation/Beautiful Days at the Movies/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Beautiful Days at the Movies/index.ts @@ -1,4 +1,4 @@ -import { reverseNum } from '@Helpers' +import { reverseNum } from '@Helpers'; /** * Determines the number of days in the range that are beautiful. * Beautiful numbers are defined as numbers where |i - reverse(i)| is evenly divisible by k. @@ -9,9 +9,9 @@ import { reverseNum } from '@Helpers' * @returns {number} The number of beautiful days in the range */ const beautifulDays = (i: number, j: number, k: number): number => { - let count = 0 + let count = 0; for (let l = i; l <= j; l++) - if (Math.abs(l - reverseNum(l)) % k === 0) count++ - return count -} -export default beautifulDays + if (Math.abs(l - reverseNum(l)) % k === 0) count++; + return count; +}; +export default beautifulDays; diff --git a/src/Problem Solving/Algorithms/Implementation/Between Two Sets/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Between Two Sets/index.test.ts index d6d4c32..46ed9b7 100644 --- a/src/Problem Solving/Algorithms/Implementation/Between Two Sets/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Between Two Sets/index.test.ts @@ -1,5 +1,5 @@ -import { getTotalX } from '@ProblemSolving/Algorithms/Implementation' +import { getTotalX } from '@ProblemSolving/Algorithms/Implementation'; test('should return the number of integers that are between the sets', () => { - expect(getTotalX([2, 4], [16, 32, 96])).toBe(3) -}) + expect(getTotalX([2, 4], [16, 32, 96])).toBe(3); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Between Two Sets/index.ts b/src/Problem Solving/Algorithms/Implementation/Between Two Sets/index.ts index dae4c67..40ef2f0 100644 --- a/src/Problem Solving/Algorithms/Implementation/Between Two Sets/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Between Two Sets/index.ts @@ -9,25 +9,25 @@ */ const getTotalX = (a: number[], b: number[]): number => { let count = 0, - isValid: boolean + isValid: boolean; for (let i = a.at(-1); typeof i === 'number' && i <= b[0]; i++) { - isValid = true + isValid = true; for (let j = 0; j < a.length; j++) { if (i % a[j] !== 0) { - isValid = false - break + isValid = false; + break; } } - if (!isValid) continue + if (!isValid) continue; for (let j = 0; j < b.length; j++) { if (b[j] % i !== 0) { - isValid = false - break + isValid = false; + break; } } - if (isValid) count++ + if (isValid) count++; } - return count -} + return count; +}; -export default getTotalX +export default getTotalX; diff --git a/src/Problem Solving/Algorithms/Implementation/Bill Division/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Bill Division/index.test.ts index 5b15908..e4090d2 100644 --- a/src/Problem Solving/Algorithms/Implementation/Bill Division/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Bill Division/index.test.ts @@ -1,7 +1,7 @@ -import { bonAppetit } from '@ProblemSolving/Algorithms/Implementation' +import { bonAppetit } from '@ProblemSolving/Algorithms/Implementation'; test('should log the overcharged amount', () => { - console.log = jest.fn() - bonAppetit([3, 10, 2, 9], 1, 12) - expect(console.log).toHaveBeenCalledWith(5) -}) + console.log = jest.fn(); + bonAppetit([3, 10, 2, 9], 1, 12); + expect(console.log).toHaveBeenCalledWith(5); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Bill Division/index.ts b/src/Problem Solving/Algorithms/Implementation/Bill Division/index.ts index bf0c023..4b72325 100644 --- a/src/Problem Solving/Algorithms/Implementation/Bill Division/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Bill Division/index.ts @@ -7,8 +7,8 @@ */ const bonAppetit = (bill: number[], k: number, b: number): void => { const annaBill = - bill.reduce((acc, cur, idx) => (idx === k ? acc : acc + cur)) / 2 - console.log(b === annaBill ? 'Bon Appetit' : b - annaBill) -} + bill.reduce((acc, cur, idx) => (idx === k ? acc : acc + cur)) / 2; + console.log(b === annaBill ? 'Bon Appetit' : b - annaBill); +}; -export default bonAppetit +export default bonAppetit; diff --git a/src/Problem Solving/Algorithms/Implementation/Breaking the Records/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Breaking the Records/index.test.ts index 9c5cf09..2d90007 100644 --- a/src/Problem Solving/Algorithms/Implementation/Breaking the Records/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Breaking the Records/index.test.ts @@ -1,5 +1,5 @@ -import { breakingRecords } from '@ProblemSolving/Algorithms/Implementation' +import { breakingRecords } from '@ProblemSolving/Algorithms/Implementation'; test('should return the numbers representing the times most points records and least points records have been broken', () => { - expect(breakingRecords([10, 5, 20, 20, 4, 5, 2, 25, 1])).toEqual([2, 4]) -}) + expect(breakingRecords([10, 5, 20, 20, 4, 5, 2, 25, 1])).toEqual([2, 4]); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Breaking the Records/index.ts b/src/Problem Solving/Algorithms/Implementation/Breaking the Records/index.ts index a639be6..decc866 100644 --- a/src/Problem Solving/Algorithms/Implementation/Breaking the Records/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Breaking the Records/index.ts @@ -5,20 +5,20 @@ * @returns {[number, number]} The array contains the numbers representing the times records have been broken */ const breakingRecords = (scores: number[]): [number, number] => { - const minMax = Array(2).fill(scores[0]) + const minMax = Array(2).fill(scores[0]); return scores.reduce( (acc, cur) => { if (cur > minMax[1]) { - minMax[1] = cur - acc[0]++ + minMax[1] = cur; + acc[0]++; } else if (cur < minMax[0]) { - minMax[0] = cur - acc[1]++ + minMax[0] = cur; + acc[1]++; } - return acc + return acc; }, [0, 0] - ) -} + ); +}; -export default breakingRecords +export default breakingRecords; diff --git a/src/Problem Solving/Algorithms/Implementation/Cats and a Mouse/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Cats and a Mouse/index.test.ts index 5a338d8..5d13349 100644 --- a/src/Problem Solving/Algorithms/Implementation/Cats and a Mouse/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Cats and a Mouse/index.test.ts @@ -1,5 +1,5 @@ -import { catAndMouse } from '@ProblemSolving/Algorithms/Implementation' +import { catAndMouse } from '@ProblemSolving/Algorithms/Implementation'; test('should return Either "Cat A", "Cat B", or "Mouse C"', () => { - expect(catAndMouse(1, 2, 3)).toBe('Cat B') -}) + expect(catAndMouse(1, 2, 3)).toBe('Cat B'); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Cats and a Mouse/index.ts b/src/Problem Solving/Algorithms/Implementation/Cats and a Mouse/index.ts index 0d2a1e1..ada4805 100644 --- a/src/Problem Solving/Algorithms/Implementation/Cats and a Mouse/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Cats and a Mouse/index.ts @@ -11,13 +11,13 @@ const catAndMouse = ( y: number, z: number ): 'Cat A' | 'Cat B' | 'Mouse C' => { - const catADistanceDiff = Math.abs(x - z) - const catBDistanceDiff = Math.abs(y - z) + const catADistanceDiff = Math.abs(x - z); + const catBDistanceDiff = Math.abs(y - z); return catBDistanceDiff > catADistanceDiff ? 'Cat A' : catADistanceDiff > catBDistanceDiff ? 'Cat B' - : 'Mouse C' -} + : 'Mouse C'; +}; -export default catAndMouse +export default catAndMouse; diff --git a/src/Problem Solving/Algorithms/Implementation/Chocolate Feast/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Chocolate Feast/index.test.ts index a602539..25b7509 100644 --- a/src/Problem Solving/Algorithms/Implementation/Chocolate Feast/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Chocolate Feast/index.test.ts @@ -1,5 +1,5 @@ -import { chocolateFeast } from '@ProblemSolving/Algorithms/Implementation' +import { chocolateFeast } from '@ProblemSolving/Algorithms/Implementation'; test('should return the number of chocolates Bobby can eat', () => { - expect(chocolateFeast(10, 2, 5)).toBe(6) -}) + expect(chocolateFeast(10, 2, 5)).toBe(6); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Chocolate Feast/index.ts b/src/Problem Solving/Algorithms/Implementation/Chocolate Feast/index.ts index f6bcb7d..445eae5 100644 --- a/src/Problem Solving/Algorithms/Implementation/Chocolate Feast/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Chocolate Feast/index.ts @@ -8,12 +8,12 @@ */ const chocolateFeast = (n: number, c: number, m: number): number => { let barsCount = Math.floor(n / c), - wrappersCount = Math.floor(n / c) + wrappersCount = Math.floor(n / c); while (wrappersCount >= m) { - wrappersCount = wrappersCount - m + 1 - barsCount += 1 + wrappersCount = wrappersCount - m + 1; + barsCount += 1; } - return barsCount -} + return barsCount; +}; -export default chocolateFeast +export default chocolateFeast; diff --git a/src/Problem Solving/Algorithms/Implementation/Circular Array Rotation/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Circular Array Rotation/index.test.ts index 812615c..72048d6 100644 --- a/src/Problem Solving/Algorithms/Implementation/Circular Array Rotation/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Circular Array Rotation/index.test.ts @@ -1,5 +1,5 @@ -import { circularArrayRotation } from '@ProblemSolving/Algorithms/Implementation' +import { circularArrayRotation } from '@ProblemSolving/Algorithms/Implementation'; test('should return the values in the rotated array', () => { - expect(circularArrayRotation([1, 2, 3], 2, [0, 1, 2])).toEqual([2, 3, 1]) -}) + expect(circularArrayRotation([1, 2, 3], 2, [0, 1, 2])).toEqual([2, 3, 1]); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Circular Array Rotation/index.ts b/src/Problem Solving/Algorithms/Implementation/Circular Array Rotation/index.ts index b15412e..bf58a4a 100644 --- a/src/Problem Solving/Algorithms/Implementation/Circular Array Rotation/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Circular Array Rotation/index.ts @@ -12,10 +12,10 @@ const circularArrayRotation = ( queries: number[] ): number[] => { const aCopy = [...a], - rotatedQueries: number[] = [] - for (let i = 0; i < k; i++) aCopy.unshift(aCopy.pop()!) - for (const query of queries) rotatedQueries.push(aCopy[query]) - return rotatedQueries -} + rotatedQueries: number[] = []; + for (let i = 0; i < k; i++) aCopy.unshift(aCopy.pop()!); + for (const query of queries) rotatedQueries.push(aCopy[query]); + return rotatedQueries; +}; -export default circularArrayRotation +export default circularArrayRotation; diff --git a/src/Problem Solving/Algorithms/Implementation/Counting Valleys/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Counting Valleys/index.test.ts index 547d8b3..694a94b 100644 --- a/src/Problem Solving/Algorithms/Implementation/Counting Valleys/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Counting Valleys/index.test.ts @@ -1,5 +1,5 @@ -import { countingValleys } from '@ProblemSolving/Algorithms/Implementation' +import { countingValleys } from '@ProblemSolving/Algorithms/Implementation'; test('should return the number of valleys traversed', () => { - expect(countingValleys(8, 'UDDDUDUU')).toBe(1) -}) + expect(countingValleys(8, 'UDDDUDUU')).toBe(1); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Counting Valleys/index.ts b/src/Problem Solving/Algorithms/Implementation/Counting Valleys/index.ts index 327f78a..bc75a1f 100644 --- a/src/Problem Solving/Algorithms/Implementation/Counting Valleys/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Counting Valleys/index.ts @@ -9,14 +9,14 @@ const countingValleys = (steps: number, path: string): number => { const stepVal: Record = { U: 1, D: -1, - } + }; let pos = 0, - count = 0 + count = 0; for (const step of path) { - pos += stepVal[step] - if (!pos && step === 'U') count++ + pos += stepVal[step]; + if (!pos && step === 'U') count++; } - return count -} + return count; +}; -export default countingValleys +export default countingValleys; diff --git a/src/Problem Solving/Algorithms/Implementation/Day of the Programmer/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Day of the Programmer/index.test.ts index f8c83c7..fed1e12 100644 --- a/src/Problem Solving/Algorithms/Implementation/Day of the Programmer/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Day of the Programmer/index.test.ts @@ -1,5 +1,5 @@ -import { dayOfProgrammer } from '@ProblemSolving/Algorithms/Implementation' +import { dayOfProgrammer } from '@ProblemSolving/Algorithms/Implementation'; test('should return date of the programmer day in the form [dd.mm.yyyy]', () => { - expect(dayOfProgrammer(2017)).toBe('13.09.2017') -}) + expect(dayOfProgrammer(2017)).toBe('13.09.2017'); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Day of the Programmer/index.ts b/src/Problem Solving/Algorithms/Implementation/Day of the Programmer/index.ts index 6b8b8b5..8be3f31 100644 --- a/src/Problem Solving/Algorithms/Implementation/Day of the Programmer/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Day of the Programmer/index.ts @@ -11,7 +11,7 @@ const dayOfProgrammer = (year: number): string => { (year > 1918 && (year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0))) ? `12.09.${year}` - : `13.09.${year}` -} + : `13.09.${year}`; +}; -export default dayOfProgrammer +export default dayOfProgrammer; diff --git a/src/Problem Solving/Algorithms/Implementation/Designer PDF Viewer/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Designer PDF Viewer/index.test.ts index f9c93d6..a153d55 100644 --- a/src/Problem Solving/Algorithms/Implementation/Designer PDF Viewer/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Designer PDF Viewer/index.test.ts @@ -1,4 +1,4 @@ -import { designerPdfViewer } from '@ProblemSolving/Algorithms/Implementation' +import { designerPdfViewer } from '@ProblemSolving/Algorithms/Implementation'; test('should return the size of the highlighted area', () => { expect( @@ -9,5 +9,5 @@ test('should return the size of the highlighted area', () => { ], 'abc' ) - ).toBe(9) -}) + ).toBe(9); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Designer PDF Viewer/index.ts b/src/Problem Solving/Algorithms/Implementation/Designer PDF Viewer/index.ts index 8f5706b..46f1d3a 100644 --- a/src/Problem Solving/Algorithms/Implementation/Designer PDF Viewer/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Designer PDF Viewer/index.ts @@ -6,11 +6,11 @@ * @returns {number} The size of the highlighted area */ const designerPdfViewer = (h: number[], word: string): number => { - const wordIdxArr = word.split('').map((ch) => ch.charCodeAt(0) - 97) + const wordIdxArr = word.split('').map((ch) => ch.charCodeAt(0) - 97); return ( Math.max(...h.filter((_, idx) => wordIdxArr.includes(idx))) * word.length - ) -} + ); +}; -export default designerPdfViewer +export default designerPdfViewer; diff --git a/src/Problem Solving/Algorithms/Implementation/Divisible Sum Pairs/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Divisible Sum Pairs/index.test.ts index 583c057..d534e8e 100644 --- a/src/Problem Solving/Algorithms/Implementation/Divisible Sum Pairs/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Divisible Sum Pairs/index.test.ts @@ -1,5 +1,5 @@ -import { divisibleSumPairs } from '@ProblemSolving/Algorithms/Implementation' +import { divisibleSumPairs } from '@ProblemSolving/Algorithms/Implementation'; test('should return the number of pairs', () => { - expect(divisibleSumPairs(6, 3, [1, 3, 2, 6, 1, 2])).toBe(5) -}) + expect(divisibleSumPairs(6, 3, [1, 3, 2, 6, 1, 2])).toBe(5); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Divisible Sum Pairs/index.ts b/src/Problem Solving/Algorithms/Implementation/Divisible Sum Pairs/index.ts index a65d835..dbcb552 100644 --- a/src/Problem Solving/Algorithms/Implementation/Divisible Sum Pairs/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Divisible Sum Pairs/index.ts @@ -7,13 +7,13 @@ * @returns {number} The number of pairs */ const divisibleSumPairs = (n: number, k: number, ar: number[]): number => { - let count = 0 + let count = 0; for (let i = 0; i < n; i++) { for (let j = i + 1; j < n; j++) { - if ((ar[i] + ar[j]) % k === 0) count++ + if ((ar[i] + ar[j]) % k === 0) count++; } } - return count -} + return count; +}; -export default divisibleSumPairs +export default divisibleSumPairs; diff --git a/src/Problem Solving/Algorithms/Implementation/Drawing Book/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Drawing Book/index.test.ts index d80f8c6..d7b3c35 100644 --- a/src/Problem Solving/Algorithms/Implementation/Drawing Book/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Drawing Book/index.test.ts @@ -1,5 +1,5 @@ -import { pageCount } from '@ProblemSolving/Algorithms/Implementation' +import { pageCount } from '@ProblemSolving/Algorithms/Implementation'; test('should return the number of pages to turn', () => { - expect(pageCount(6, 2)).toBe(1) -}) + expect(pageCount(6, 2)).toBe(1); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Drawing Book/index.ts b/src/Problem Solving/Algorithms/Implementation/Drawing Book/index.ts index f3a0719..c87c487 100644 --- a/src/Problem Solving/Algorithms/Implementation/Drawing Book/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Drawing Book/index.ts @@ -6,6 +6,6 @@ * @returns {number} The minimum number of pages to turn */ const pageCount = (n: number, p: number): number => - Math.min(Math.floor(p / 2), Math.floor((n - p + +(n % 2 === 0)) / 2)) + Math.min(Math.floor(p / 2), Math.floor((n - p + +(n % 2 === 0)) / 2)); -export default pageCount +export default pageCount; diff --git a/src/Problem Solving/Algorithms/Implementation/Electronics Shop/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Electronics Shop/index.test.ts index 4acfbaf..1626819 100644 --- a/src/Problem Solving/Algorithms/Implementation/Electronics Shop/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Electronics Shop/index.test.ts @@ -1,5 +1,5 @@ -import { getMoneySpent } from '@ProblemSolving/Algorithms/Implementation' +import { getMoneySpent } from '@ProblemSolving/Algorithms/Implementation'; test('should return the maximum that can be spent', () => { - expect(getMoneySpent([3, 1], [5, 2, 8], 10)).toBe(9) -}) + expect(getMoneySpent([3, 1], [5, 2, 8], 10)).toBe(9); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Electronics Shop/index.ts b/src/Problem Solving/Algorithms/Implementation/Electronics Shop/index.ts index 273c44a..c4aac00 100644 --- a/src/Problem Solving/Algorithms/Implementation/Electronics Shop/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Electronics Shop/index.ts @@ -11,13 +11,13 @@ const getMoneySpent = ( drives: number[], b: number ): number => { - let totalPrice = -1 + let totalPrice = -1; for (const keyboard of keyboards) { for (const drive of drives) { - if (b >= keyboard + drive) totalPrice = keyboard + drive + if (b >= keyboard + drive) totalPrice = keyboard + drive; } } - return totalPrice -} + return totalPrice; +}; -export default getMoneySpent +export default getMoneySpent; diff --git a/src/Problem Solving/Algorithms/Implementation/Fair Rations/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Fair Rations/index.test.ts index 51175be..0ec3aa5 100644 --- a/src/Problem Solving/Algorithms/Implementation/Fair Rations/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Fair Rations/index.test.ts @@ -1,5 +1,5 @@ -import { fairRations } from '@ProblemSolving/Algorithms/Implementation' +import { fairRations } from '@ProblemSolving/Algorithms/Implementation'; test('should return the minimum number of loaves required', () => { - expect(fairRations([2, 3, 4, 5, 6])).toBe(4) -}) + expect(fairRations([2, 3, 4, 5, 6])).toBe(4); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Fair Rations/index.ts b/src/Problem Solving/Algorithms/Implementation/Fair Rations/index.ts index a0582e9..37fa543 100644 --- a/src/Problem Solving/Algorithms/Implementation/Fair Rations/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Fair Rations/index.ts @@ -10,16 +10,16 @@ * @returns {number | "NO"} The minimum number of loaves required or 'NO' */ const fairRations = (B: number[]): number | 'NO' => { - const rationsLine = [...B] - let count = 0 + const rationsLine = [...B]; + let count = 0; for (let i = 0; i < rationsLine.length - 1; i++) { if (rationsLine[i] % 2 !== 0) { - rationsLine[i]++ - rationsLine[i + 1]++ - count += 2 + rationsLine[i]++; + rationsLine[i + 1]++; + count += 2; } } - return rationsLine.at(-1)! % 2 === 0 ? count : 'NO' -} + return rationsLine.at(-1)! % 2 === 0 ? count : 'NO'; +}; -export default fairRations +export default fairRations; diff --git a/src/Problem Solving/Algorithms/Implementation/Find Digits/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Find Digits/index.test.ts index dd4dd14..5e191ba 100644 --- a/src/Problem Solving/Algorithms/Implementation/Find Digits/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Find Digits/index.test.ts @@ -1,5 +1,5 @@ -import { findDigits } from '@ProblemSolving/Algorithms/Implementation' +import { findDigits } from '@ProblemSolving/Algorithms/Implementation'; test('should return the number of divisors', () => { - expect(findDigits(1012)).toBe(3) -}) + expect(findDigits(1012)).toBe(3); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Find Digits/index.ts b/src/Problem Solving/Algorithms/Implementation/Find Digits/index.ts index ebd251f..1f149c1 100644 --- a/src/Problem Solving/Algorithms/Implementation/Find Digits/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Find Digits/index.ts @@ -8,10 +8,10 @@ const findDigits = (n: number): number => { const numDigits = n .toString() .split('') - .map((digit) => +digit) - let count = 0 - for (const digit of numDigits) if (n % digit === 0) count++ - return count -} + .map((digit) => +digit); + let count = 0; + for (const digit of numDigits) if (n % digit === 0) count++; + return count; +}; -export default findDigits +export default findDigits; diff --git a/src/Problem Solving/Algorithms/Implementation/Flatland Space Stations/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Flatland Space Stations/index.test.ts index 582f319..95953d8 100644 --- a/src/Problem Solving/Algorithms/Implementation/Flatland Space Stations/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Flatland Space Stations/index.test.ts @@ -1,5 +1,5 @@ -import { flatlandSpaceStations } from '@ProblemSolving/Algorithms/Implementation' +import { flatlandSpaceStations } from '@ProblemSolving/Algorithms/Implementation'; test('should return the maximum distance', () => { - expect(flatlandSpaceStations(5, [0, 4])).toBe(2) -}) + expect(flatlandSpaceStations(5, [0, 4])).toBe(2); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Flatland Space Stations/index.ts b/src/Problem Solving/Algorithms/Implementation/Flatland Space Stations/index.ts index 7576071..721eca7 100644 --- a/src/Problem Solving/Algorithms/Implementation/Flatland Space Stations/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Flatland Space Stations/index.ts @@ -6,15 +6,18 @@ * @returns {number} The maximum distance any city is from a space station */ const flatlandSpaceStations = (n: number, c: number[]): number => { - let biggestGap = 0 - const sortedSpaces = [...c].sort((x, y) => x - y) + let biggestGap = 0; + const sortedSpaces = [...c].sort((x, y) => x - y); for (let i = sortedSpaces.length - 1; i > 0; i--) - biggestGap = Math.max(sortedSpaces[i] - sortedSpaces[i - 1], biggestGap) + biggestGap = Math.max( + sortedSpaces[i] - sortedSpaces[i - 1], + biggestGap + ); return Math.max( Math.floor(biggestGap / 2), sortedSpaces[0], n - sortedSpaces.at(-1)! - 1 - ) -} + ); +}; -export default flatlandSpaceStations +export default flatlandSpaceStations; diff --git a/src/Problem Solving/Algorithms/Implementation/Grading Students/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Grading Students/index.test.ts index ee9a5aa..2a5f767 100644 --- a/src/Problem Solving/Algorithms/Implementation/Grading Students/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Grading Students/index.test.ts @@ -1,5 +1,5 @@ -import { gradingStudents } from '@ProblemSolving/Algorithms/Implementation' +import { gradingStudents } from '@ProblemSolving/Algorithms/Implementation'; test('should return the rounded grades of students', () => { - expect(gradingStudents([73, 67, 38, 33])).toEqual([75, 67, 40, 33]) -}) + expect(gradingStudents([73, 67, 38, 33])).toEqual([75, 67, 40, 33]); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Grading Students/index.ts b/src/Problem Solving/Algorithms/Implementation/Grading Students/index.ts index 097ee4b..5d4a64a 100644 --- a/src/Problem Solving/Algorithms/Implementation/Grading Students/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Grading Students/index.ts @@ -6,9 +6,9 @@ */ const gradingStudents = (grades: number[]): number[] => { return grades.map((grade) => { - const nextMultiple = Math.ceil(grade / 5) * 5 - return !(grade < 38) && nextMultiple - grade < 3 ? nextMultiple : grade - }) -} + const nextMultiple = Math.ceil(grade / 5) * 5; + return !(grade < 38) && nextMultiple - grade < 3 ? nextMultiple : grade; + }); +}; -export default gradingStudents +export default gradingStudents; diff --git a/src/Problem Solving/Algorithms/Implementation/Jumping on the Clouds (Revisited)/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Jumping on the Clouds (Revisited)/index.test.ts index 2d1b323..6bd8e5c 100644 --- a/src/Problem Solving/Algorithms/Implementation/Jumping on the Clouds (Revisited)/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Jumping on the Clouds (Revisited)/index.test.ts @@ -1,5 +1,5 @@ -import { jumpingOnClouds } from '@ProblemSolving/Algorithms/Implementation' +import { jumpingOnClouds } from '@ProblemSolving/Algorithms/Implementation'; test('should return the remaining energy level', () => { - expect(jumpingOnClouds([0, 0, 1, 0, 0, 1, 1, 0], 2)).toBe(92) -}) + expect(jumpingOnClouds([0, 0, 1, 0, 0, 1, 1, 0], 2)).toBe(92); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Jumping on the Clouds (Revisited)/index.ts b/src/Problem Solving/Algorithms/Implementation/Jumping on the Clouds (Revisited)/index.ts index 914e079..0936e2f 100644 --- a/src/Problem Solving/Algorithms/Implementation/Jumping on the Clouds (Revisited)/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Jumping on the Clouds (Revisited)/index.ts @@ -6,14 +6,14 @@ * @returns {number} The energy level remaining. */ const jumpingOnClouds = (c: number[], k: number): number => { - const n = c.length + const n = c.length; let remainingEnergy = 100, - curCloud = 0 + curCloud = 0; do { - curCloud = (curCloud + k) % n - remainingEnergy -= c[curCloud] ? 3 : 1 - } while (curCloud) - return remainingEnergy -} + curCloud = (curCloud + k) % n; + remainingEnergy -= c[curCloud] ? 3 : 1; + } while (curCloud); + return remainingEnergy; +}; -export default jumpingOnClouds +export default jumpingOnClouds; diff --git a/src/Problem Solving/Algorithms/Implementation/Lisa's Workbook/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Lisa's Workbook/index.test.ts index 31af18d..7f621ad 100644 --- a/src/Problem Solving/Algorithms/Implementation/Lisa's Workbook/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Lisa's Workbook/index.test.ts @@ -1,5 +1,5 @@ -import { workbook } from '@ProblemSolving/Algorithms/Implementation' +import { workbook } from '@ProblemSolving/Algorithms/Implementation'; test('should return the number of special problems in the workbook', () => { - expect(workbook(5, 3, [4, 2, 6, 1, 10])).toBe(4) -}) + expect(workbook(5, 3, [4, 2, 6, 1, 10])).toBe(4); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Lisa's Workbook/index.ts b/src/Problem Solving/Algorithms/Implementation/Lisa's Workbook/index.ts index 57a5c8d..453a36a 100644 --- a/src/Problem Solving/Algorithms/Implementation/Lisa's Workbook/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Lisa's Workbook/index.ts @@ -7,27 +7,27 @@ * @returns {number} The number of special problems in the workbook */ const workbook = (n: number, k: number, arr: number[]): number => { - let pageNum = 0 + let pageNum = 0; const detailedArr = arr.reduce((acc, cur) => { - const problemsArr: number[] = Array(Math.floor(cur / k)).fill(k) - acc.push(cur % k ? [...problemsArr, cur % k] : problemsArr) - return acc - }, [] as number[][]) + const problemsArr: number[] = Array(Math.floor(cur / k)).fill(k); + acc.push(cur % k ? [...problemsArr, cur % k] : problemsArr); + return acc; + }, [] as number[][]); return detailedArr.reduce( (acc, curArr) => acc + curArr.reduce((arrAcc, curArrElem, curArrIdx) => { - pageNum++ - const lowerBound = curArrIdx * k + 1 - const upperBound = lowerBound + curArrElem - 1 + pageNum++; + const lowerBound = curArrIdx * k + 1; + const upperBound = lowerBound + curArrElem - 1; return ( arrAcc + +(lowerBound <= pageNum && upperBound >= pageNum) - ) + ); }, 0), 0 - ) -} + ); +}; -export default workbook +export default workbook; diff --git a/src/Problem Solving/Algorithms/Implementation/Manasa and Stones/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Manasa and Stones/index.test.ts index 46fe29d..f9f9d02 100644 --- a/src/Problem Solving/Algorithms/Implementation/Manasa and Stones/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Manasa and Stones/index.test.ts @@ -1,5 +1,5 @@ -import { stones } from '@ProblemSolving/Algorithms/Implementation' +import { stones } from '@ProblemSolving/Algorithms/Implementation'; test('should return possible values of the last stone', () => { - expect(stones(3, 1, 2)).toEqual([2, 3, 4]) -}) + expect(stones(3, 1, 2)).toEqual([2, 3, 4]); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Manasa and Stones/index.ts b/src/Problem Solving/Algorithms/Implementation/Manasa and Stones/index.ts index 56a3198..651945e 100644 --- a/src/Problem Solving/Algorithms/Implementation/Manasa and Stones/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Manasa and Stones/index.ts @@ -1,4 +1,4 @@ -import { recursiveSum } from '@Helpers' +import { recursiveSum } from '@Helpers'; /** * Computes all possible numbers that might occur on the last stone @@ -9,6 +9,6 @@ import { recursiveSum } from '@Helpers' * @returns {number[]} all possible values of the last stone, sorted ascending */ const stones = (n: number, a: number, b: number): number[] => - recursiveSum(0, n - 1, [a, b]) + recursiveSum(0, n - 1, [a, b]); -export default stones +export default stones; diff --git a/src/Problem Solving/Algorithms/Implementation/Migratory Birds/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Migratory Birds/index.test.ts index 00a8007..007877c 100644 --- a/src/Problem Solving/Algorithms/Implementation/Migratory Birds/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Migratory Birds/index.test.ts @@ -1,5 +1,5 @@ -import { migratoryBirds } from '@ProblemSolving/Algorithms/Implementation' +import { migratoryBirds } from '@ProblemSolving/Algorithms/Implementation'; test('should return the id of the most frequently sighted bird type', () => { - expect(migratoryBirds([1, 4, 4, 4, 5, 3])).toBe(4) -}) + expect(migratoryBirds([1, 4, 4, 4, 5, 3])).toBe(4); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Migratory Birds/index.ts b/src/Problem Solving/Algorithms/Implementation/Migratory Birds/index.ts index 24c67f7..6db8e09 100644 --- a/src/Problem Solving/Algorithms/Implementation/Migratory Birds/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Migratory Birds/index.ts @@ -1,4 +1,4 @@ -import { countDuplicates } from '@Helpers' +import { countDuplicates } from '@Helpers'; /** * Determines the id of the most frequently sighted bird type * @author Andrew Mamdouh @@ -6,12 +6,12 @@ import { countDuplicates } from '@Helpers' * @returns {number} The lowest type id of the most frequently sighted birds */ const migratoryBirds = (arr: number[]): number => { - const result = countDuplicates(arr) + const result = countDuplicates(arr); return +( Object.keys(result).find( (key) => result[key] === Math.max(...Object.values(result)) ) ?? 0 - ) -} + ); +}; -export default migratoryBirds +export default migratoryBirds; diff --git a/src/Problem Solving/Algorithms/Implementation/Minimum Distances/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Minimum Distances/index.test.ts index 189e46e..98dad3b 100644 --- a/src/Problem Solving/Algorithms/Implementation/Minimum Distances/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Minimum Distances/index.test.ts @@ -1,5 +1,5 @@ -import { minimumDistances } from '@ProblemSolving/Algorithms/Implementation' +import { minimumDistances } from '@ProblemSolving/Algorithms/Implementation'; test('should return the minimum distance between any pair of equal elements in the array', () => { - expect(minimumDistances([7, 1, 3, 4, 1, 7])).toBe(3) -}) + expect(minimumDistances([7, 1, 3, 4, 1, 7])).toBe(3); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Minimum Distances/index.ts b/src/Problem Solving/Algorithms/Implementation/Minimum Distances/index.ts index 212e5f6..9dc301e 100644 --- a/src/Problem Solving/Algorithms/Implementation/Minimum Distances/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Minimum Distances/index.ts @@ -5,17 +5,17 @@ * @returns {number} The minimum distance found or -1 if there are no matching elements */ const minimumDistances = (a: number[]): number => { - let minDistanceIdxDiff: number | undefined + let minDistanceIdxDiff: number | undefined; for (let i = 0; i < a.length; i++) { const matchedDistanceIdx = - a.slice(i + 1).findIndex((dis) => dis === a[i]) + 1 + a.slice(i + 1).findIndex((dis) => dis === a[i]) + 1; if ( matchedDistanceIdx && (!minDistanceIdxDiff || minDistanceIdxDiff > matchedDistanceIdx) ) - minDistanceIdxDiff = matchedDistanceIdx + minDistanceIdxDiff = matchedDistanceIdx; } - return minDistanceIdxDiff ?? -1 -} + return minDistanceIdxDiff ?? -1; +}; -export default minimumDistances +export default minimumDistances; diff --git a/src/Problem Solving/Algorithms/Implementation/Number Line Jumps/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Number Line Jumps/index.test.ts index 4831702..9c085e9 100644 --- a/src/Problem Solving/Algorithms/Implementation/Number Line Jumps/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Number Line Jumps/index.test.ts @@ -1,5 +1,5 @@ -import { kangaroo } from '@ProblemSolving/Algorithms/Implementation' +import { kangaroo } from '@ProblemSolving/Algorithms/Implementation'; test('should return whether both kangaroos can reach at the same location at the same time or not', () => { - expect(kangaroo(0, 3, 4, 2)).toBe('YES') -}) + expect(kangaroo(0, 3, 4, 2)).toBe('YES'); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Number Line Jumps/index.ts b/src/Problem Solving/Algorithms/Implementation/Number Line Jumps/index.ts index 155aa8f..40de770 100644 --- a/src/Problem Solving/Algorithms/Implementation/Number Line Jumps/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Number Line Jumps/index.ts @@ -13,9 +13,9 @@ const kangaroo = ( x2: number, v2: number ): 'YES' | 'NO' => { - if ((x1 > x2 && v1 >= v2) || (x2 > x1 && v2 >= v1)) return 'NO' - const jumps = (x2 - x1) / (v1 - v2) - return jumps >= 0 && Number.isInteger(jumps) ? 'YES' : 'NO' -} + if ((x1 > x2 && v1 >= v2) || (x2 > x1 && v2 >= v1)) return 'NO'; + const jumps = (x2 - x1) / (v1 - v2); + return jumps >= 0 && Number.isInteger(jumps) ? 'YES' : 'NO'; +}; -export default kangaroo +export default kangaroo; diff --git a/src/Problem Solving/Algorithms/Implementation/Picking Numbers/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Picking Numbers/index.test.ts index ebdf76a..6037ec4 100644 --- a/src/Problem Solving/Algorithms/Implementation/Picking Numbers/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Picking Numbers/index.test.ts @@ -1,5 +1,5 @@ -import { pickingNumbers } from '@ProblemSolving/Algorithms/Implementation' +import { pickingNumbers } from '@ProblemSolving/Algorithms/Implementation'; test('should return the length of the longest subarray', () => { - expect(pickingNumbers([4, 6, 5, 3, 3, 1])).toBe(3) -}) + expect(pickingNumbers([4, 6, 5, 3, 3, 1])).toBe(3); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Picking Numbers/index.ts b/src/Problem Solving/Algorithms/Implementation/Picking Numbers/index.ts index 024ae34..40e136a 100644 --- a/src/Problem Solving/Algorithms/Implementation/Picking Numbers/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Picking Numbers/index.ts @@ -1,4 +1,4 @@ -import { countDuplicates } from '@Helpers' +import { countDuplicates } from '@Helpers'; /** * Finds the longest subarray where the absolute difference between any two elements is less than or equal to 1 * @author Andrew Mamdouh @@ -6,15 +6,15 @@ import { countDuplicates } from '@Helpers' * @returns {number} The length of the longest subarray that meets the criterion */ const pickingNumbers = (a: number[]): number => { - const result = countDuplicates(a) - let maxLength = 0 + const result = countDuplicates(a); + let maxLength = 0; Object.entries(result).forEach((entry, idx, arr) => { if (idx + 1 !== arr.length && +arr[idx + 1][0] - +entry[0] === 1) { - const newMax = entry[1] + arr[idx + 1][1] - if (newMax > maxLength) maxLength = newMax + const newMax = entry[1] + arr[idx + 1][1]; + if (newMax > maxLength) maxLength = newMax; } - }) - return maxLength -} + }); + return maxLength; +}; -export default pickingNumbers +export default pickingNumbers; diff --git a/src/Problem Solving/Algorithms/Implementation/Sales by Match/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Sales by Match/index.test.ts index f44ae38..4bcfe55 100644 --- a/src/Problem Solving/Algorithms/Implementation/Sales by Match/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Sales by Match/index.test.ts @@ -1,5 +1,5 @@ -import { sockMerchant } from '@ProblemSolving/Algorithms/Implementation' +import { sockMerchant } from '@ProblemSolving/Algorithms/Implementation'; test('should return the number of pairs', () => { - expect(sockMerchant(9, [10, 20, 20, 10, 10, 30, 50, 10, 20])).toBe(3) -}) + expect(sockMerchant(9, [10, 20, 20, 10, 10, 30, 50, 10, 20])).toBe(3); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Sales by Match/index.ts b/src/Problem Solving/Algorithms/Implementation/Sales by Match/index.ts index 08e53eb..a1362a2 100644 --- a/src/Problem Solving/Algorithms/Implementation/Sales by Match/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Sales by Match/index.ts @@ -1,4 +1,4 @@ -import { countDuplicates } from '@Helpers' +import { countDuplicates } from '@Helpers'; /** * Determines how many pairs of socks with matching colors there are * @author Andrew Mamdouh @@ -7,11 +7,11 @@ import { countDuplicates } from '@Helpers' * @returns {number} The number of pairs */ const sockMerchant = (n: number, ar: number[]): number => { - const colorPairs = countDuplicates(ar) + const colorPairs = countDuplicates(ar); return Object.values(colorPairs).reduce( (acc, cur) => acc + Math.floor(cur / 2), 0 - ) -} + ); +}; -export default sockMerchant +export default sockMerchant; diff --git a/src/Problem Solving/Algorithms/Implementation/Save the Prisoner/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Save the Prisoner/index.test.ts index 2f1c24a..29dfe1c 100644 --- a/src/Problem Solving/Algorithms/Implementation/Save the Prisoner/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Save the Prisoner/index.test.ts @@ -1,5 +1,5 @@ -import { saveThePrisoner } from '@ProblemSolving/Algorithms/Implementation' +import { saveThePrisoner } from '@ProblemSolving/Algorithms/Implementation'; test('should return the chair number of the prisoner to warn', () => { - expect(saveThePrisoner(5, 2, 1)).toBe(2) -}) + expect(saveThePrisoner(5, 2, 1)).toBe(2); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Save the Prisoner/index.ts b/src/Problem Solving/Algorithms/Implementation/Save the Prisoner/index.ts index a8feb83..a2dc399 100644 --- a/src/Problem Solving/Algorithms/Implementation/Save the Prisoner/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Save the Prisoner/index.ts @@ -7,8 +7,8 @@ * @returns {number} The chair number of the prisoner to warn */ const saveThePrisoner = (n: number, m: number, s: number): number => { - const chairNum = (m % n || n) + (s - 1) - return chairNum > n ? chairNum - n : chairNum -} + const chairNum = (m % n || n) + (s - 1); + return chairNum > n ? chairNum - n : chairNum; +}; -export default saveThePrisoner +export default saveThePrisoner; diff --git a/src/Problem Solving/Algorithms/Implementation/Sequence Equation/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Sequence Equation/index.test.ts index d706646..8b624b7 100644 --- a/src/Problem Solving/Algorithms/Implementation/Sequence Equation/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Sequence Equation/index.test.ts @@ -1,5 +1,5 @@ -import { permutationEquation } from '@ProblemSolving/Algorithms/Implementation' +import { permutationEquation } from '@ProblemSolving/Algorithms/Implementation'; test('should return the permuted array', () => { - expect(permutationEquation([2, 3, 1])).toEqual([2, 3, 1]) -}) + expect(permutationEquation([2, 3, 1])).toEqual([2, 3, 1]); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Sequence Equation/index.ts b/src/Problem Solving/Algorithms/Implementation/Sequence Equation/index.ts index 716d523..f6a56f6 100644 --- a/src/Problem Solving/Algorithms/Implementation/Sequence Equation/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Sequence Equation/index.ts @@ -5,14 +5,14 @@ * @returns {number[]} The values of (y) for all (x) in the arithmetic sequence 1 to n */ const permutationEquation = (p: number[]): number[] => { - let firstPermutation: number, secondPermutation: number - const permutationArr: number[] = [] + let firstPermutation: number, secondPermutation: number; + const permutationArr: number[] = []; for (let i = 1; i <= p.length; i++) { - firstPermutation = p.findIndex((e) => e === i) + 1 - secondPermutation = p.findIndex((e) => e === firstPermutation) + 1 - permutationArr.push(secondPermutation) + firstPermutation = p.findIndex((e) => e === i) + 1; + secondPermutation = p.findIndex((e) => e === firstPermutation) + 1; + permutationArr.push(secondPermutation); } - return permutationArr -} + return permutationArr; +}; -export default permutationEquation +export default permutationEquation; diff --git a/src/Problem Solving/Algorithms/Implementation/Sherlock and Squares/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Sherlock and Squares/index.test.ts index 9072627..d81336b 100644 --- a/src/Problem Solving/Algorithms/Implementation/Sherlock and Squares/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Sherlock and Squares/index.test.ts @@ -1,5 +1,5 @@ -import { squares } from '@ProblemSolving/Algorithms/Implementation' +import { squares } from '@ProblemSolving/Algorithms/Implementation'; test('should return the number of square integers in the range', () => { - expect(squares(3, 9)).toBe(2) -}) + expect(squares(3, 9)).toBe(2); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Sherlock and Squares/index.ts b/src/Problem Solving/Algorithms/Implementation/Sherlock and Squares/index.ts index a9ac5d8..2eebd7b 100644 --- a/src/Problem Solving/Algorithms/Implementation/Sherlock and Squares/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Sherlock and Squares/index.ts @@ -6,6 +6,6 @@ * @returns {number} The number of square integers in the range */ const squares = (a: number, b: number): number => - Math.floor(Math.sqrt(b)) - Math.ceil(Math.sqrt(a)) + 1 + Math.floor(Math.sqrt(b)) - Math.ceil(Math.sqrt(a)) + 1; -export default squares +export default squares; diff --git a/src/Problem Solving/Algorithms/Implementation/Subarray Division/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Subarray Division/index.test.ts index 4f05c13..d247dce 100644 --- a/src/Problem Solving/Algorithms/Implementation/Subarray Division/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Subarray Division/index.test.ts @@ -1,5 +1,5 @@ -import { birthday } from '@ProblemSolving/Algorithms/Implementation' +import { birthday } from '@ProblemSolving/Algorithms/Implementation'; test('should return the number of ways the chocolate bar can be divided', () => { - expect(birthday([1, 2, 1, 3, 2], 3, 2)).toBe(2) -}) + expect(birthday([1, 2, 1, 3, 2], 3, 2)).toBe(2); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Subarray Division/index.ts b/src/Problem Solving/Algorithms/Implementation/Subarray Division/index.ts index 7349347..a48bbfb 100644 --- a/src/Problem Solving/Algorithms/Implementation/Subarray Division/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Subarray Division/index.ts @@ -10,15 +10,15 @@ */ const birthday = (s: number[], d: number, m: number): number => { let sum: number, - count = 0 + count = 0; for (let i = 0; i <= s.length - m; i++) { - sum = 0 + sum = 0; for (let j = i; j < i + m; j++) { - sum += s[j] + sum += s[j]; } - if (sum === d) count++ + if (sum === d) count++; } - return count -} + return count; +}; -export default birthday +export default birthday; diff --git a/src/Problem Solving/Algorithms/Implementation/The Hurdle Race/index.test.ts b/src/Problem Solving/Algorithms/Implementation/The Hurdle Race/index.test.ts index 70d6525..06471fa 100644 --- a/src/Problem Solving/Algorithms/Implementation/The Hurdle Race/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/The Hurdle Race/index.test.ts @@ -1,5 +1,5 @@ -import { theHurdleRace } from '@ProblemSolving/Algorithms/Implementation' +import { theHurdleRace } from '@ProblemSolving/Algorithms/Implementation'; test('should return how many doses are required', () => { - expect(theHurdleRace(4, [1, 6, 3, 5, 2])).toBe(2) -}) + expect(theHurdleRace(4, [1, 6, 3, 5, 2])).toBe(2); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/The Hurdle Race/index.ts b/src/Problem Solving/Algorithms/Implementation/The Hurdle Race/index.ts index cf8c0e5..33d2450 100644 --- a/src/Problem Solving/Algorithms/Implementation/The Hurdle Race/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/The Hurdle Race/index.ts @@ -6,8 +6,8 @@ * @returns {number} The minimum number of doses required */ const hurdleRace = (k: number, height: number[]): number => { - const doses = Math.max(...height) - k - return doses > 0 ? doses : 0 -} + const doses = Math.max(...height) - k; + return doses > 0 ? doses : 0; +}; -export default hurdleRace +export default hurdleRace; diff --git a/src/Problem Solving/Algorithms/Implementation/Utopian Tree/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Utopian Tree/index.test.ts index cf42c10..491a1f0 100644 --- a/src/Problem Solving/Algorithms/Implementation/Utopian Tree/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Utopian Tree/index.test.ts @@ -1,5 +1,5 @@ -import { utopianTree } from '@ProblemSolving/Algorithms/Implementation' +import { utopianTree } from '@ProblemSolving/Algorithms/Implementation'; test('should return how tall will the tree be', () => { - expect(utopianTree(4)).toBe(7) -}) + expect(utopianTree(4)).toBe(7); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Utopian Tree/index.ts b/src/Problem Solving/Algorithms/Implementation/Utopian Tree/index.ts index 3522159..a361fab 100644 --- a/src/Problem Solving/Algorithms/Implementation/Utopian Tree/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Utopian Tree/index.ts @@ -5,9 +5,9 @@ * @returns {number} The height of the tree after the given number of cycles */ const utopianTree = (n: number): number => { - if (!n) return 1 - if (n % 2) return utopianTree(n - 1) * 2 - return utopianTree(n - 1) + 1 -} + if (!n) return 1; + if (n % 2) return utopianTree(n - 1) * 2; + return utopianTree(n - 1) + 1; +}; -export default utopianTree +export default utopianTree; diff --git a/src/Problem Solving/Algorithms/Implementation/Viral Advertising/index.test.ts b/src/Problem Solving/Algorithms/Implementation/Viral Advertising/index.test.ts index 17fba2b..2c8ac1d 100644 --- a/src/Problem Solving/Algorithms/Implementation/Viral Advertising/index.test.ts +++ b/src/Problem Solving/Algorithms/Implementation/Viral Advertising/index.test.ts @@ -1,5 +1,5 @@ -import { viralAdvertising } from '@ProblemSolving/Algorithms/Implementation' +import { viralAdvertising } from '@ProblemSolving/Algorithms/Implementation'; test('should return how many people have liked the ad', () => { - expect(viralAdvertising(3)).toBe(9) -}) + expect(viralAdvertising(3)).toBe(9); +}); diff --git a/src/Problem Solving/Algorithms/Implementation/Viral Advertising/index.ts b/src/Problem Solving/Algorithms/Implementation/Viral Advertising/index.ts index 937e471..f24666b 100644 --- a/src/Problem Solving/Algorithms/Implementation/Viral Advertising/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/Viral Advertising/index.ts @@ -7,13 +7,13 @@ const viralAdvertising = (n: number): number => { let curLikes: number, totalLikes = 0, - exposes = 5 + exposes = 5; for (let i = 0; i < n; i++) { - curLikes = Math.floor(exposes / 2) - totalLikes += curLikes - exposes = curLikes * 3 + curLikes = Math.floor(exposes / 2); + totalLikes += curLikes; + exposes = curLikes * 3; } - return totalLikes -} + return totalLikes; +}; -export default viralAdvertising +export default viralAdvertising; diff --git a/src/Problem Solving/Algorithms/Implementation/index.ts b/src/Problem Solving/Algorithms/Implementation/index.ts index d72e0f3..509b5ed 100644 --- a/src/Problem Solving/Algorithms/Implementation/index.ts +++ b/src/Problem Solving/Algorithms/Implementation/index.ts @@ -1,73 +1,73 @@ -import countApplesAndOranges from '@ProblemSolving/Algorithms/Implementation/Apple and Orange' -import getTotalX from '@ProblemSolving/Algorithms/Implementation/Between Two Sets' -import breakingRecords from '@ProblemSolving/Algorithms/Implementation/Breaking the Records' -import dayOfProgrammer from '@ProblemSolving/Algorithms/Implementation/Day of the Programmer' -import gradingStudents from '@ProblemSolving/Algorithms/Implementation/Grading Students' -import workbook from "@ProblemSolving/Algorithms/Implementation/Lisa's Workbook" -import kangaroo from '@ProblemSolving/Algorithms/Implementation/Number Line Jumps' -import birthday from '@ProblemSolving/Algorithms/Implementation/Subarray Division' -import stones from '@ProblemSolving/Algorithms/Implementation/Manasa and Stones' -import pickingNumbers from '@ProblemSolving/Algorithms/Implementation/Picking Numbers' -import catAndMouse from '@ProblemSolving/Algorithms/Implementation/Cats and a Mouse' -import migratoryBirds from '@ProblemSolving/Algorithms/Implementation/Migratory Birds' -import theHurdleRace from '@ProblemSolving/Algorithms/Implementation/The Hurdle Race' -import getMoneySpent from '@ProblemSolving/Algorithms/Implementation/Electronics Shop' -import minimumDistances from '@ProblemSolving/Algorithms/Implementation/Minimum Distances' -import chocolateFeast from '@ProblemSolving/Algorithms/Implementation/Chocolate Feast' -import divisibleSumPairs from '@ProblemSolving/Algorithms/Implementation/Divisible Sum Pairs' -import bonAppetit from '@ProblemSolving/Algorithms/Implementation/Bill Division' -import sockMerchant from '@ProblemSolving/Algorithms/Implementation/Sales by Match' -import pageCount from '@ProblemSolving/Algorithms/Implementation/Drawing Book' -import countingValleys from '@ProblemSolving/Algorithms/Implementation/Counting Valleys' -import designerPdfViewer from '@ProblemSolving/Algorithms/Implementation/Designer PDF Viewer' -import utopianTree from '@ProblemSolving/Algorithms/Implementation/Utopian Tree' -import angryProfessor from '@ProblemSolving/Algorithms/Implementation/Angry Professor' -import beautifulDays from '@ProblemSolving/Algorithms/Implementation/Beautiful Days at the Movies' -import viralAdvertising from '@ProblemSolving/Algorithms/Implementation/Viral Advertising' -import saveThePrisoner from '@ProblemSolving/Algorithms/Implementation/Save the Prisoner' -import circularArrayRotation from '@ProblemSolving/Algorithms/Implementation/Circular Array Rotation' -import permutationEquation from '@ProblemSolving/Algorithms/Implementation/Sequence Equation' -import jumpingOnClouds from '@ProblemSolving/Algorithms/Implementation/Jumping on the Clouds (Revisited)' -import findDigits from '@ProblemSolving/Algorithms/Implementation/Find Digits' -import appendAndDelete from '@ProblemSolving/Algorithms/Implementation/Append and Delete' -import squares from '@ProblemSolving/Algorithms/Implementation/Sherlock and Squares' -import flatlandSpaceStations from '@ProblemSolving/Algorithms/Implementation/Flatland Space Stations' -import fairRations from '@ProblemSolving/Algorithms/Implementation/Fair Rations' +import countApplesAndOranges from '@ProblemSolving/Algorithms/Implementation/Apple and Orange'; +import getTotalX from '@ProblemSolving/Algorithms/Implementation/Between Two Sets'; +import breakingRecords from '@ProblemSolving/Algorithms/Implementation/Breaking the Records'; +import dayOfProgrammer from '@ProblemSolving/Algorithms/Implementation/Day of the Programmer'; +import gradingStudents from '@ProblemSolving/Algorithms/Implementation/Grading Students'; +import workbook from "@ProblemSolving/Algorithms/Implementation/Lisa's Workbook"; +import kangaroo from '@ProblemSolving/Algorithms/Implementation/Number Line Jumps'; +import birthday from '@ProblemSolving/Algorithms/Implementation/Subarray Division'; +import stones from '@ProblemSolving/Algorithms/Implementation/Manasa and Stones'; +import pickingNumbers from '@ProblemSolving/Algorithms/Implementation/Picking Numbers'; +import catAndMouse from '@ProblemSolving/Algorithms/Implementation/Cats and a Mouse'; +import migratoryBirds from '@ProblemSolving/Algorithms/Implementation/Migratory Birds'; +import theHurdleRace from '@ProblemSolving/Algorithms/Implementation/The Hurdle Race'; +import getMoneySpent from '@ProblemSolving/Algorithms/Implementation/Electronics Shop'; +import minimumDistances from '@ProblemSolving/Algorithms/Implementation/Minimum Distances'; +import chocolateFeast from '@ProblemSolving/Algorithms/Implementation/Chocolate Feast'; +import divisibleSumPairs from '@ProblemSolving/Algorithms/Implementation/Divisible Sum Pairs'; +import bonAppetit from '@ProblemSolving/Algorithms/Implementation/Bill Division'; +import sockMerchant from '@ProblemSolving/Algorithms/Implementation/Sales by Match'; +import pageCount from '@ProblemSolving/Algorithms/Implementation/Drawing Book'; +import countingValleys from '@ProblemSolving/Algorithms/Implementation/Counting Valleys'; +import designerPdfViewer from '@ProblemSolving/Algorithms/Implementation/Designer PDF Viewer'; +import utopianTree from '@ProblemSolving/Algorithms/Implementation/Utopian Tree'; +import angryProfessor from '@ProblemSolving/Algorithms/Implementation/Angry Professor'; +import beautifulDays from '@ProblemSolving/Algorithms/Implementation/Beautiful Days at the Movies'; +import viralAdvertising from '@ProblemSolving/Algorithms/Implementation/Viral Advertising'; +import saveThePrisoner from '@ProblemSolving/Algorithms/Implementation/Save the Prisoner'; +import circularArrayRotation from '@ProblemSolving/Algorithms/Implementation/Circular Array Rotation'; +import permutationEquation from '@ProblemSolving/Algorithms/Implementation/Sequence Equation'; +import jumpingOnClouds from '@ProblemSolving/Algorithms/Implementation/Jumping on the Clouds (Revisited)'; +import findDigits from '@ProblemSolving/Algorithms/Implementation/Find Digits'; +import appendAndDelete from '@ProblemSolving/Algorithms/Implementation/Append and Delete'; +import squares from '@ProblemSolving/Algorithms/Implementation/Sherlock and Squares'; +import flatlandSpaceStations from '@ProblemSolving/Algorithms/Implementation/Flatland Space Stations'; +import fairRations from '@ProblemSolving/Algorithms/Implementation/Fair Rations'; export { - countApplesAndOranges, - getTotalX, + angryProfessor, + appendAndDelete, + beautifulDays, + birthday, + bonAppetit, breakingRecords, + catAndMouse, + chocolateFeast, + circularArrayRotation, + countApplesAndOranges, + countingValleys, dayOfProgrammer, + designerPdfViewer, + divisibleSumPairs, + fairRations, + findDigits, + flatlandSpaceStations, + getMoneySpent, + getTotalX, gradingStudents, - workbook, + jumpingOnClouds, kangaroo, - birthday, - stones, - pickingNumbers, - catAndMouse, migratoryBirds, - theHurdleRace, - getMoneySpent, minimumDistances, - chocolateFeast, - divisibleSumPairs, - bonAppetit, - sockMerchant, pageCount, - countingValleys, - designerPdfViewer, - utopianTree, - angryProfessor, - beautifulDays, - viralAdvertising, - saveThePrisoner, - circularArrayRotation, permutationEquation, - jumpingOnClouds, - findDigits, - appendAndDelete, + pickingNumbers, + saveThePrisoner, + sockMerchant, squares, - flatlandSpaceStations, - fairRations, -} + stones, + theHurdleRace, + utopianTree, + viralAdvertising, + workbook, +}; diff --git a/src/Problem Solving/Algorithms/Sorting/Counting Sort 1/index.test.ts b/src/Problem Solving/Algorithms/Sorting/Counting Sort 1/index.test.ts index 457c980..ab093c8 100644 --- a/src/Problem Solving/Algorithms/Sorting/Counting Sort 1/index.test.ts +++ b/src/Problem Solving/Algorithms/Sorting/Counting Sort 1/index.test.ts @@ -1,4 +1,4 @@ -import { countingSort1 } from '@ProblemSolving/Algorithms/Sorting' +import { countingSort1 } from '@ProblemSolving/Algorithms/Sorting'; test('should return the frequency array', () => { expect( @@ -16,5 +16,5 @@ test('should return the frequency array', () => { 1, 0, 1, 0, 0, 1, 0, 0, 2, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 2, 1, 3, 2, 0, 0, 2, 1, 2, 1, 0, 2, 2, 1, 2, 1, 2, 1, 1, 2, 2, 0, 3, 2, 1, 1, 0, 1, 1, 1, 0, 2, 2, - ]) -}) + ]); +}); diff --git a/src/Problem Solving/Algorithms/Sorting/Counting Sort 1/index.ts b/src/Problem Solving/Algorithms/Sorting/Counting Sort 1/index.ts index 731472e..fc20b7f 100644 --- a/src/Problem Solving/Algorithms/Sorting/Counting Sort 1/index.ts +++ b/src/Problem Solving/Algorithms/Sorting/Counting Sort 1/index.ts @@ -5,11 +5,11 @@ * @returns {number[]} The frequency array */ const countingSort = (arr: number[]): number[] => { - const countArr = Array(100).fill(0) + const countArr = Array(100).fill(0); arr.forEach((e) => { - countArr[e] += 1 - }) - return countArr -} + countArr[e] += 1; + }); + return countArr; +}; -export default countingSort +export default countingSort; diff --git a/src/Problem Solving/Algorithms/Sorting/Counting Sort 2/index.test.ts b/src/Problem Solving/Algorithms/Sorting/Counting Sort 2/index.test.ts index f15427b..3e012b8 100644 --- a/src/Problem Solving/Algorithms/Sorting/Counting Sort 2/index.test.ts +++ b/src/Problem Solving/Algorithms/Sorting/Counting Sort 2/index.test.ts @@ -1,4 +1,4 @@ -import { countingSort2 } from '@ProblemSolving/Algorithms/Sorting' +import { countingSort2 } from '@ProblemSolving/Algorithms/Sorting'; test('should return the sorted array', () => { expect( @@ -17,5 +17,5 @@ test('should return the sorted array', () => { 67, 67, 68, 69, 69, 69, 70, 70, 73, 73, 74, 75, 75, 76, 78, 78, 79, 79, 80, 81, 81, 82, 83, 83, 84, 85, 86, 86, 87, 87, 89, 89, 89, 90, 90, 91, 92, 94, 95, 96, 98, 98, 99, 99, - ]) -}) + ]); +}); diff --git a/src/Problem Solving/Algorithms/Sorting/Counting Sort 2/index.ts b/src/Problem Solving/Algorithms/Sorting/Counting Sort 2/index.ts index 6756a5f..f1f2440 100644 --- a/src/Problem Solving/Algorithms/Sorting/Counting Sort 2/index.ts +++ b/src/Problem Solving/Algorithms/Sorting/Counting Sort 2/index.ts @@ -5,14 +5,14 @@ * @returns {number[]} The sorted array */ const countingSort = (arr: number[]): number[] => { - const countArr: number[] = [] + const countArr: number[] = []; arr.forEach((e) => { - countArr[e] = countArr[e] ? countArr[e] + 1 : 1 - }) + countArr[e] = countArr[e] ? countArr[e] + 1 : 1; + }); return countArr.reduce( (acc, cur, idx) => (cur ? acc.concat(Array(cur).fill(idx)) : acc), [] as number[] - ) -} + ); +}; -export default countingSort +export default countingSort; diff --git a/src/Problem Solving/Algorithms/Sorting/Find the Median/index.test.ts b/src/Problem Solving/Algorithms/Sorting/Find the Median/index.test.ts index a57f1a9..7eefd0e 100644 --- a/src/Problem Solving/Algorithms/Sorting/Find the Median/index.test.ts +++ b/src/Problem Solving/Algorithms/Sorting/Find the Median/index.test.ts @@ -1,5 +1,5 @@ -import { findMedian } from '@ProblemSolving/Algorithms/Sorting' +import { findMedian } from '@ProblemSolving/Algorithms/Sorting'; test('should return the median of the array', () => { - expect(findMedian([0, 1, 2, 4, 6, 5, 3])).toBe(3) -}) + expect(findMedian([0, 1, 2, 4, 6, 5, 3])).toBe(3); +}); diff --git a/src/Problem Solving/Algorithms/Sorting/Find the Median/index.ts b/src/Problem Solving/Algorithms/Sorting/Find the Median/index.ts index bc3e583..0956156 100644 --- a/src/Problem Solving/Algorithms/Sorting/Find the Median/index.ts +++ b/src/Problem Solving/Algorithms/Sorting/Find the Median/index.ts @@ -5,8 +5,8 @@ * @returns {number} The median of the array */ const findMedian = (arr: number[]): number => { - arr.sort((x, y) => x - y) - return arr[Math.floor(arr.length / 2)] -} + arr.sort((x, y) => x - y); + return arr[Math.floor(arr.length / 2)]; +}; -export default findMedian +export default findMedian; diff --git a/src/Problem Solving/Algorithms/Sorting/index.ts b/src/Problem Solving/Algorithms/Sorting/index.ts index b79cbea..ef700e0 100644 --- a/src/Problem Solving/Algorithms/Sorting/index.ts +++ b/src/Problem Solving/Algorithms/Sorting/index.ts @@ -1,5 +1,5 @@ -import countingSort1 from '@ProblemSolving/Algorithms/Sorting/Counting Sort 1' -import countingSort2 from '@ProblemSolving/Algorithms/Sorting/Counting Sort 2' -import findMedian from '@ProblemSolving/Algorithms/Sorting/Find the Median' +import countingSort1 from '@ProblemSolving/Algorithms/Sorting/Counting Sort 1'; +import countingSort2 from '@ProblemSolving/Algorithms/Sorting/Counting Sort 2'; +import findMedian from '@ProblemSolving/Algorithms/Sorting/Find the Median'; -export { countingSort1, countingSort2, findMedian } +export { countingSort1, countingSort2, findMedian }; diff --git a/src/Problem Solving/Algorithms/Strings/CamelCase/index.test.ts b/src/Problem Solving/Algorithms/Strings/CamelCase/index.test.ts index 2d8ae2b..7fc330d 100644 --- a/src/Problem Solving/Algorithms/Strings/CamelCase/index.test.ts +++ b/src/Problem Solving/Algorithms/Strings/CamelCase/index.test.ts @@ -1,5 +1,5 @@ -import { camelcase } from '@ProblemSolving/Algorithms/Strings' +import { camelcase } from '@ProblemSolving/Algorithms/Strings'; test('should return the number of words', () => { - expect(camelcase('saveChangesInTheEditor')).toBe(5) -}) + expect(camelcase('saveChangesInTheEditor')).toBe(5); +}); diff --git a/src/Problem Solving/Algorithms/Strings/CamelCase/index.ts b/src/Problem Solving/Algorithms/Strings/CamelCase/index.ts index d45b06b..857b141 100644 --- a/src/Problem Solving/Algorithms/Strings/CamelCase/index.ts +++ b/src/Problem Solving/Algorithms/Strings/CamelCase/index.ts @@ -4,6 +4,6 @@ * @param {string} s - The string to analyze * @returns {number} The number of words in the string */ -const camelcase = (s: string): number => s.split(/(?=[A-Z])/).length +const camelcase = (s: string): number => s.split(/(?=[A-Z])/).length; -export default camelcase +export default camelcase; diff --git a/src/Problem Solving/Algorithms/Strings/HackerRank in a String!/index.test.ts b/src/Problem Solving/Algorithms/Strings/HackerRank in a String!/index.test.ts index 869970b..6757c8d 100644 --- a/src/Problem Solving/Algorithms/Strings/HackerRank in a String!/index.test.ts +++ b/src/Problem Solving/Algorithms/Strings/HackerRank in a String!/index.test.ts @@ -1,5 +1,5 @@ -import { hackerrankInString } from '@ProblemSolving/Algorithms/Strings' +import { hackerrankInString } from '@ProblemSolving/Algorithms/Strings'; test("should return whether 'YES' | 'NO'", () => { - expect(hackerrankInString('hereiamstackerrank')).toBe('YES') -}) + expect(hackerrankInString('hereiamstackerrank')).toBe('YES'); +}); diff --git a/src/Problem Solving/Algorithms/Strings/HackerRank in a String!/index.ts b/src/Problem Solving/Algorithms/Strings/HackerRank in a String!/index.ts index 400ac6a..c6fee45 100644 --- a/src/Problem Solving/Algorithms/Strings/HackerRank in a String!/index.ts +++ b/src/Problem Solving/Algorithms/Strings/HackerRank in a String!/index.ts @@ -5,12 +5,12 @@ * @returns {"YES" | "NO"} Whether string includes the word "hackerrank" */ const hackerrankInString = (s: string): 'YES' | 'NO' => { - const sequence = 'hackerrank' - let lastIdx = -1 + const sequence = 'hackerrank'; + let lastIdx = -1; for (let i = 0; i < sequence.length; i++) { - lastIdx = s.indexOf(sequence[i], lastIdx + 1) - if (lastIdx === -1) return 'NO' + lastIdx = s.indexOf(sequence[i], lastIdx + 1); + if (lastIdx === -1) return 'NO'; } - return 'YES' -} -export default hackerrankInString + return 'YES'; +}; +export default hackerrankInString; diff --git a/src/Problem Solving/Algorithms/Strings/Mars Exploration/index.test.ts b/src/Problem Solving/Algorithms/Strings/Mars Exploration/index.test.ts index e2d804f..0fdd905 100644 --- a/src/Problem Solving/Algorithms/Strings/Mars Exploration/index.test.ts +++ b/src/Problem Solving/Algorithms/Strings/Mars Exploration/index.test.ts @@ -1,5 +1,5 @@ -import { marsExploration } from '@ProblemSolving/Algorithms/Strings' +import { marsExploration } from '@ProblemSolving/Algorithms/Strings'; test('should return the number of changed letters', () => { - expect(marsExploration('SOSSPSSQSSOR')).toBe(3) -}) + expect(marsExploration('SOSSPSSQSSOR')).toBe(3); +}); diff --git a/src/Problem Solving/Algorithms/Strings/Mars Exploration/index.ts b/src/Problem Solving/Algorithms/Strings/Mars Exploration/index.ts index 7dc0f8b..120aed7 100644 --- a/src/Problem Solving/Algorithms/Strings/Mars Exploration/index.ts +++ b/src/Problem Solving/Algorithms/Strings/Mars Exploration/index.ts @@ -5,15 +5,15 @@ * @returns {number} The number of letters changed during transmission */ const marsExploration = (s: string): number => { - const validMsg = 'SOS' - const msgCount = s.length / 3 + const validMsg = 'SOS'; + const msgCount = s.length / 3; let msg, - alters = 0 + alters = 0; for (let i = 0; i < msgCount; i++) { - msg = s.substring(i * 3, i * 3 + 3) - for (let j = 0; j < 3; j++) alters += validMsg[j] !== msg[j] ? 1 : 0 + msg = s.substring(i * 3, i * 3 + 3); + for (let j = 0; j < 3; j++) alters += validMsg[j] !== msg[j] ? 1 : 0; } - return alters -} + return alters; +}; -export default marsExploration +export default marsExploration; diff --git a/src/Problem Solving/Algorithms/Strings/Strong Password/index.test.ts b/src/Problem Solving/Algorithms/Strings/Strong Password/index.test.ts index 1bae812..4ddb61c 100644 --- a/src/Problem Solving/Algorithms/Strings/Strong Password/index.test.ts +++ b/src/Problem Solving/Algorithms/Strings/Strong Password/index.test.ts @@ -1,5 +1,5 @@ -import { minimumNumber } from '@ProblemSolving/Algorithms/Strings' +import { minimumNumber } from '@ProblemSolving/Algorithms/Strings'; test('should return the number of characters needed to be a strong password', () => { - expect(minimumNumber(3, 'Ab1')).toBe(3) -}) + expect(minimumNumber(3, 'Ab1')).toBe(3); +}); diff --git a/src/Problem Solving/Algorithms/Strings/Strong Password/index.ts b/src/Problem Solving/Algorithms/Strings/Strong Password/index.ts index 1fa18b5..6a166fd 100644 --- a/src/Problem Solving/Algorithms/Strings/Strong Password/index.ts +++ b/src/Problem Solving/Algorithms/Strings/Strong Password/index.ts @@ -11,12 +11,12 @@ const minimumNumber = (n: number, password: string): number => { /^(?=.*[A-Z])/, /^(?=.*[0-9])/, /(?=.*[!@#$%^&*()\-+])/, - ] + ]; const lacksCount = regexArr.reduce( (acc, cur) => (password.match(cur) ? acc : ++acc), 0 - ) - return n + lacksCount > 5 ? lacksCount : 6 - n -} + ); + return n + lacksCount > 5 ? lacksCount : 6 - n; +}; -export default minimumNumber +export default minimumNumber; diff --git a/src/Problem Solving/Algorithms/Strings/Super Reduced String/index.test.ts b/src/Problem Solving/Algorithms/Strings/Super Reduced String/index.test.ts index d7e3950..5f95c2f 100644 --- a/src/Problem Solving/Algorithms/Strings/Super Reduced String/index.test.ts +++ b/src/Problem Solving/Algorithms/Strings/Super Reduced String/index.test.ts @@ -1,5 +1,5 @@ -import { superReducedString } from '@ProblemSolving/Algorithms/Strings' +import { superReducedString } from '@ProblemSolving/Algorithms/Strings'; test('should return the reduced string', () => { - expect(superReducedString('aaabccddd')).toBe('abd') -}) + expect(superReducedString('aaabccddd')).toBe('abd'); +}); diff --git a/src/Problem Solving/Algorithms/Strings/Super Reduced String/index.ts b/src/Problem Solving/Algorithms/Strings/Super Reduced String/index.ts index ee4df96..dc45a9a 100644 --- a/src/Problem Solving/Algorithms/Strings/Super Reduced String/index.ts +++ b/src/Problem Solving/Algorithms/Strings/Super Reduced String/index.ts @@ -5,12 +5,12 @@ * @returns {string} The reduced string or "Empty String" */ const superReducedString = (s: string): string => { - let charStack = '' + let charStack = ''; for (const char of s) { - if (char === charStack.at(-1)) charStack = charStack.slice(0, -1) - else charStack += char + if (char === charStack.at(-1)) charStack = charStack.slice(0, -1); + else charStack += char; } - return charStack ? charStack : 'Empty String' -} + return charStack ? charStack : 'Empty String'; +}; -export default superReducedString +export default superReducedString; diff --git a/src/Problem Solving/Algorithms/Strings/index.ts b/src/Problem Solving/Algorithms/Strings/index.ts index 648d77b..2fa0e43 100644 --- a/src/Problem Solving/Algorithms/Strings/index.ts +++ b/src/Problem Solving/Algorithms/Strings/index.ts @@ -1,8 +1,8 @@ -import camelcase from '@ProblemSolving/Algorithms/Strings/CamelCase' -import hackerrankInString from '@ProblemSolving/Algorithms/Strings/HackerRank in a String!' -import marsExploration from '@ProblemSolving/Algorithms/Strings/Mars Exploration' -import minimumNumber from '@ProblemSolving/Algorithms/Strings/Strong Password' -import superReducedString from '@ProblemSolving/Algorithms/Strings/Super Reduced String' +import camelcase from '@ProblemSolving/Algorithms/Strings/CamelCase'; +import hackerrankInString from '@ProblemSolving/Algorithms/Strings/HackerRank in a String!'; +import marsExploration from '@ProblemSolving/Algorithms/Strings/Mars Exploration'; +import minimumNumber from '@ProblemSolving/Algorithms/Strings/Strong Password'; +import superReducedString from '@ProblemSolving/Algorithms/Strings/Super Reduced String'; export { camelcase, @@ -10,4 +10,4 @@ export { marsExploration, minimumNumber, superReducedString, -} +}; diff --git a/src/Problem Solving/Algorithms/Warmup/A Very Big Sum/index.test.ts b/src/Problem Solving/Algorithms/Warmup/A Very Big Sum/index.test.ts index bff195d..0d338a2 100644 --- a/src/Problem Solving/Algorithms/Warmup/A Very Big Sum/index.test.ts +++ b/src/Problem Solving/Algorithms/Warmup/A Very Big Sum/index.test.ts @@ -1,9 +1,9 @@ -import { aVeryBigSum } from '@ProblemSolving/Algorithms/Warmup' +import { aVeryBigSum } from '@ProblemSolving/Algorithms/Warmup'; test('should return the sum of the big numbers array', () => { expect( aVeryBigSum([ 1000000001, 1000000002, 1000000003, 1000000004, 1000000005, ]) - ).toBe(5000000015) -}) + ).toBe(5000000015); +}); diff --git a/src/Problem Solving/Algorithms/Warmup/A Very Big Sum/index.ts b/src/Problem Solving/Algorithms/Warmup/A Very Big Sum/index.ts index 7363ed3..3ebdbb7 100644 --- a/src/Problem Solving/Algorithms/Warmup/A Very Big Sum/index.ts +++ b/src/Problem Solving/Algorithms/Warmup/A Very Big Sum/index.ts @@ -5,6 +5,6 @@ * @returns {number} The sum */ const aVeryBigSum = (arr: number[]): number => - arr.reduce((acc, cur) => acc + cur) + arr.reduce((acc, cur) => acc + cur); -export default aVeryBigSum +export default aVeryBigSum; diff --git a/src/Problem Solving/Algorithms/Warmup/Birthday Cake Candles/index.test.ts b/src/Problem Solving/Algorithms/Warmup/Birthday Cake Candles/index.test.ts index 409d7d3..b9d8eb2 100644 --- a/src/Problem Solving/Algorithms/Warmup/Birthday Cake Candles/index.test.ts +++ b/src/Problem Solving/Algorithms/Warmup/Birthday Cake Candles/index.test.ts @@ -1,5 +1,5 @@ -import { birthdayCakeCandles } from '@ProblemSolving/Algorithms/Warmup' +import { birthdayCakeCandles } from '@ProblemSolving/Algorithms/Warmup'; test('should return the number of tallest candles in the array', () => { - expect(birthdayCakeCandles([3, 2, 1, 3])).toBe(2) -}) + expect(birthdayCakeCandles([3, 2, 1, 3])).toBe(2); +}); diff --git a/src/Problem Solving/Algorithms/Warmup/Birthday Cake Candles/index.ts b/src/Problem Solving/Algorithms/Warmup/Birthday Cake Candles/index.ts index ca2838a..dd4472f 100644 --- a/src/Problem Solving/Algorithms/Warmup/Birthday Cake Candles/index.ts +++ b/src/Problem Solving/Algorithms/Warmup/Birthday Cake Candles/index.ts @@ -5,8 +5,8 @@ * @returns {number} The number of candles that are tallest */ const birthdayCakeCandles = (candles: number[]): number => { - const tallest = Math.max(...candles) - return candles.reduce((acc, cur) => (cur === tallest ? acc + 1 : acc), 0) -} + const tallest = Math.max(...candles); + return candles.reduce((acc, cur) => (cur === tallest ? acc + 1 : acc), 0); +}; -export default birthdayCakeCandles +export default birthdayCakeCandles; diff --git a/src/Problem Solving/Algorithms/Warmup/Compare the Triplets/index.test.ts b/src/Problem Solving/Algorithms/Warmup/Compare the Triplets/index.test.ts index db15d12..297b236 100644 --- a/src/Problem Solving/Algorithms/Warmup/Compare the Triplets/index.test.ts +++ b/src/Problem Solving/Algorithms/Warmup/Compare the Triplets/index.test.ts @@ -1,5 +1,5 @@ -import { compareTriplets } from '@ProblemSolving/Algorithms/Warmup' +import { compareTriplets } from '@ProblemSolving/Algorithms/Warmup'; test('should compare two triplets and return a tuple of two numbers', () => { - expect(compareTriplets([5, 6, 7], [3, 6, 10])).toEqual([1, 1]) -}) + expect(compareTriplets([5, 6, 7], [3, 6, 10])).toEqual([1, 1]); +}); diff --git a/src/Problem Solving/Algorithms/Warmup/Compare the Triplets/index.ts b/src/Problem Solving/Algorithms/Warmup/Compare the Triplets/index.ts index 3091718..00e3a9f 100644 --- a/src/Problem Solving/Algorithms/Warmup/Compare the Triplets/index.ts +++ b/src/Problem Solving/Algorithms/Warmup/Compare the Triplets/index.ts @@ -8,12 +8,12 @@ const compareTriplets = (a: number[], b: number[]): [number, number] => { return a.reduce( (acc, cur, idx) => { - if (cur > b[idx]) acc[0]++ - else if (cur < b[idx]) acc[1]++ - return acc + if (cur > b[idx]) acc[0]++; + else if (cur < b[idx]) acc[1]++; + return acc; }, [0, 0] - ) -} + ); +}; -export default compareTriplets +export default compareTriplets; diff --git a/src/Problem Solving/Algorithms/Warmup/Diagonal Difference/index.test.ts b/src/Problem Solving/Algorithms/Warmup/Diagonal Difference/index.test.ts index 1733160..4fd50a4 100644 --- a/src/Problem Solving/Algorithms/Warmup/Diagonal Difference/index.test.ts +++ b/src/Problem Solving/Algorithms/Warmup/Diagonal Difference/index.test.ts @@ -1,4 +1,4 @@ -import { diagonalDifference } from '@ProblemSolving/Algorithms/Warmup' +import { diagonalDifference } from '@ProblemSolving/Algorithms/Warmup'; test('should return the absolute diagonal difference of 2d array', () => { expect( @@ -7,5 +7,5 @@ test('should return the absolute diagonal difference of 2d array', () => { [4, 5, 6], [10, 8, -12], ]) - ).toBe(15) -}) + ).toBe(15); +}); diff --git a/src/Problem Solving/Algorithms/Warmup/Diagonal Difference/index.ts b/src/Problem Solving/Algorithms/Warmup/Diagonal Difference/index.ts index f11cab8..78b0003 100644 --- a/src/Problem Solving/Algorithms/Warmup/Diagonal Difference/index.ts +++ b/src/Problem Solving/Algorithms/Warmup/Diagonal Difference/index.ts @@ -5,10 +5,10 @@ * @returns {number} The absolute diagonal difference */ const diagonalDifference = (arr: number[][]): number => { - const maxIdx = arr.length - 1 + const maxIdx = arr.length - 1; return Math.abs( arr.reduce((acc, cur, idx) => acc + cur[idx] - cur[maxIdx - idx], 0) - ) -} + ); +}; -export default diagonalDifference +export default diagonalDifference; diff --git a/src/Problem Solving/Algorithms/Warmup/Mini-Max Sum/index.test.ts b/src/Problem Solving/Algorithms/Warmup/Mini-Max Sum/index.test.ts index 57d04f4..f04f687 100644 --- a/src/Problem Solving/Algorithms/Warmup/Mini-Max Sum/index.test.ts +++ b/src/Problem Solving/Algorithms/Warmup/Mini-Max Sum/index.test.ts @@ -1,5 +1,5 @@ -import { miniMaxSum } from '@ProblemSolving/Algorithms/Warmup' +import { miniMaxSum } from '@ProblemSolving/Algorithms/Warmup'; test('should return the min-max sum of the array', () => { - expect(miniMaxSum([1, 2, 3, 4, 5])).toEqual([10, 14]) -}) + expect(miniMaxSum([1, 2, 3, 4, 5])).toEqual([10, 14]); +}); diff --git a/src/Problem Solving/Algorithms/Warmup/Mini-Max Sum/index.ts b/src/Problem Solving/Algorithms/Warmup/Mini-Max Sum/index.ts index 075cefb..053bdfa 100644 --- a/src/Problem Solving/Algorithms/Warmup/Mini-Max Sum/index.ts +++ b/src/Problem Solving/Algorithms/Warmup/Mini-Max Sum/index.ts @@ -5,9 +5,9 @@ * @returns {[number, number]} The min-max sum [min, max] */ const miniMaxSum = (arr: number[]): [number, number] => { - const sum = arr.reduce((acc, cur) => acc + cur) - arr.sort((x, y) => x - y) - return [sum - (arr.at(-1) || 0), sum - arr[0]] -} + const sum = arr.reduce((acc, cur) => acc + cur); + arr.sort((x, y) => x - y); + return [sum - (arr.at(-1) || 0), sum - arr[0]]; +}; -export default miniMaxSum +export default miniMaxSum; diff --git a/src/Problem Solving/Algorithms/Warmup/Plus Minus/index.test.ts b/src/Problem Solving/Algorithms/Warmup/Plus Minus/index.test.ts index 3fe501b..86e55d0 100644 --- a/src/Problem Solving/Algorithms/Warmup/Plus Minus/index.test.ts +++ b/src/Problem Solving/Algorithms/Warmup/Plus Minus/index.test.ts @@ -1,9 +1,9 @@ -import { plusMinus } from '@ProblemSolving/Algorithms/Warmup' +import { plusMinus } from '@ProblemSolving/Algorithms/Warmup'; test('should return the ratios of positive, negative and zero values in the array', () => { expect(plusMinus([-4, 3, -9, 0, 4, 1])).toEqual([ '0.500000', '0.333333', '0.166667', - ]) -}) + ]); +}); diff --git a/src/Problem Solving/Algorithms/Warmup/Plus Minus/index.ts b/src/Problem Solving/Algorithms/Warmup/Plus Minus/index.ts index 0f4f847..b560752 100644 --- a/src/Problem Solving/Algorithms/Warmup/Plus Minus/index.ts +++ b/src/Problem Solving/Algorithms/Warmup/Plus Minus/index.ts @@ -7,16 +7,16 @@ const plusMinus = (arr: number[]): [string, string, string] => { const ratios: [number, number, number] = arr.reduce( (acc, cur) => { - acc[cur > 0 ? 0 : cur < 0 ? 1 : 2]++ - return acc + acc[cur > 0 ? 0 : cur < 0 ? 1 : 2]++; + return acc; }, [0, 0, 0] - ) + ); return ratios.map((ratio) => (ratio / arr.length).toFixed(6)) as [ string, string, string, - ] -} + ]; +}; -export default plusMinus +export default plusMinus; diff --git a/src/Problem Solving/Algorithms/Warmup/Simple Array Sum/index.test.ts b/src/Problem Solving/Algorithms/Warmup/Simple Array Sum/index.test.ts index d88da27..203a197 100644 --- a/src/Problem Solving/Algorithms/Warmup/Simple Array Sum/index.test.ts +++ b/src/Problem Solving/Algorithms/Warmup/Simple Array Sum/index.test.ts @@ -1,5 +1,5 @@ -import { simpleArraySum } from '@ProblemSolving/Algorithms/Warmup' +import { simpleArraySum } from '@ProblemSolving/Algorithms/Warmup'; test('should return the sum of the array', () => { - expect(simpleArraySum([1, 2, 3, 4, 10, 11])).toBe(31) -}) + expect(simpleArraySum([1, 2, 3, 4, 10, 11])).toBe(31); +}); diff --git a/src/Problem Solving/Algorithms/Warmup/Simple Array Sum/index.ts b/src/Problem Solving/Algorithms/Warmup/Simple Array Sum/index.ts index 5fcb4e4..e8ae916 100644 --- a/src/Problem Solving/Algorithms/Warmup/Simple Array Sum/index.ts +++ b/src/Problem Solving/Algorithms/Warmup/Simple Array Sum/index.ts @@ -5,6 +5,6 @@ * @returns {number} The sum */ const simpleArraySum = (arr: number[]): number => - arr.reduce((acc, cur) => acc + cur) + arr.reduce((acc, cur) => acc + cur); -export default simpleArraySum +export default simpleArraySum; diff --git a/src/Problem Solving/Algorithms/Warmup/Solve Me First/index.test.ts b/src/Problem Solving/Algorithms/Warmup/Solve Me First/index.test.ts index 3700131..ee0f013 100644 --- a/src/Problem Solving/Algorithms/Warmup/Solve Me First/index.test.ts +++ b/src/Problem Solving/Algorithms/Warmup/Solve Me First/index.test.ts @@ -1,5 +1,5 @@ -import { solveMeFirst } from '@ProblemSolving/Algorithms/Warmup' +import { solveMeFirst } from '@ProblemSolving/Algorithms/Warmup'; test('should add two numbers', () => { - expect(solveMeFirst(2, 3)).toBe(5) -}) + expect(solveMeFirst(2, 3)).toBe(5); +}); diff --git a/src/Problem Solving/Algorithms/Warmup/Solve Me First/index.ts b/src/Problem Solving/Algorithms/Warmup/Solve Me First/index.ts index 991fcd0..06be51c 100644 --- a/src/Problem Solving/Algorithms/Warmup/Solve Me First/index.ts +++ b/src/Problem Solving/Algorithms/Warmup/Solve Me First/index.ts @@ -5,6 +5,6 @@ * @param {number} b - Second number * @returns {number} The sum of two numbers */ -const solveMeFirst = (a: number, b: number): number => a + b +const solveMeFirst = (a: number, b: number): number => a + b; -export default solveMeFirst +export default solveMeFirst; diff --git a/src/Problem Solving/Algorithms/Warmup/Staircase/index.test.ts b/src/Problem Solving/Algorithms/Warmup/Staircase/index.test.ts index 471887a..b4e3db3 100644 --- a/src/Problem Solving/Algorithms/Warmup/Staircase/index.test.ts +++ b/src/Problem Solving/Algorithms/Warmup/Staircase/index.test.ts @@ -1,7 +1,7 @@ -import { staircase } from '@ProblemSolving/Algorithms/Warmup' +import { staircase } from '@ProblemSolving/Algorithms/Warmup'; test('should return a staircase as string', () => { expect(staircase(6)).toMatch( ' #\n ##\n ###\n ####\n #####\n######\n' - ) -}) + ); +}); diff --git a/src/Problem Solving/Algorithms/Warmup/Staircase/index.ts b/src/Problem Solving/Algorithms/Warmup/Staircase/index.ts index d14df6e..e88e39f 100644 --- a/src/Problem Solving/Algorithms/Warmup/Staircase/index.ts +++ b/src/Problem Solving/Algorithms/Warmup/Staircase/index.ts @@ -5,11 +5,11 @@ * @returns {string} The staircase using # symbols and spaces. */ const staircase = (n: number): string => { - let str = '' + let str = ''; for (let i = 1; i <= n; i++) { - str += `${' '.repeat(n - i)}${'#'.repeat(i)}\n` + str += `${' '.repeat(n - i)}${'#'.repeat(i)}\n`; } - return str -} + return str; +}; -export default staircase +export default staircase; diff --git a/src/Problem Solving/Algorithms/Warmup/Time Conversion/index.test.ts b/src/Problem Solving/Algorithms/Warmup/Time Conversion/index.test.ts index 1243b60..edb2ea7 100644 --- a/src/Problem Solving/Algorithms/Warmup/Time Conversion/index.test.ts +++ b/src/Problem Solving/Algorithms/Warmup/Time Conversion/index.test.ts @@ -1,5 +1,5 @@ -import { timeConversion } from '@ProblemSolving/Algorithms/Warmup' +import { timeConversion } from '@ProblemSolving/Algorithms/Warmup'; test('should convert 12-hour time to 24-hour time', () => { - expect(timeConversion('07:05:45PM')).toMatch('19:05:45') -}) + expect(timeConversion('07:05:45PM')).toMatch('19:05:45'); +}); diff --git a/src/Problem Solving/Algorithms/Warmup/Time Conversion/index.ts b/src/Problem Solving/Algorithms/Warmup/Time Conversion/index.ts index edd6dbd..8e075ef 100644 --- a/src/Problem Solving/Algorithms/Warmup/Time Conversion/index.ts +++ b/src/Problem Solving/Algorithms/Warmup/Time Conversion/index.ts @@ -5,12 +5,12 @@ * @returns {string} The military (24-hour) time */ const timeConversion = (s: string): string => { - const timeArr = s.slice(0, 8).split(':') - const hours = parseInt(timeArr[0]) - const isAM = s.slice(-2) === 'AM' - if (isAM && hours === 12) timeArr[0] = '00' - else if (!isAM && hours !== 12) timeArr[0] = (hours + 12).toString() - return timeArr.join(':') -} + const timeArr = s.slice(0, 8).split(':'); + const hours = parseInt(timeArr[0]); + const isAM = s.slice(-2) === 'AM'; + if (isAM && hours === 12) timeArr[0] = '00'; + else if (!isAM && hours !== 12) timeArr[0] = (hours + 12).toString(); + return timeArr.join(':'); +}; -export default timeConversion +export default timeConversion; diff --git a/src/Problem Solving/Algorithms/Warmup/index.ts b/src/Problem Solving/Algorithms/Warmup/index.ts index b920ad9..0172868 100644 --- a/src/Problem Solving/Algorithms/Warmup/index.ts +++ b/src/Problem Solving/Algorithms/Warmup/index.ts @@ -1,13 +1,13 @@ -import aVeryBigSum from '@ProblemSolving/Algorithms/Warmup/A Very Big Sum' -import birthdayCakeCandles from '@ProblemSolving/Algorithms/Warmup/Birthday Cake Candles' -import compareTriplets from '@ProblemSolving/Algorithms/Warmup/Compare the Triplets' -import diagonalDifference from '@ProblemSolving/Algorithms/Warmup/Diagonal Difference' -import miniMaxSum from '@ProblemSolving/Algorithms/Warmup/Mini-Max Sum' -import plusMinus from '@ProblemSolving/Algorithms/Warmup/Plus Minus' -import simpleArraySum from '@ProblemSolving/Algorithms/Warmup/Simple Array Sum' -import solveMeFirst from '@ProblemSolving/Algorithms/Warmup/Solve Me First' -import staircase from '@ProblemSolving/Algorithms/Warmup/Staircase' -import timeConversion from '@ProblemSolving/Algorithms/Warmup/Time Conversion' +import aVeryBigSum from '@ProblemSolving/Algorithms/Warmup/A Very Big Sum'; +import birthdayCakeCandles from '@ProblemSolving/Algorithms/Warmup/Birthday Cake Candles'; +import compareTriplets from '@ProblemSolving/Algorithms/Warmup/Compare the Triplets'; +import diagonalDifference from '@ProblemSolving/Algorithms/Warmup/Diagonal Difference'; +import miniMaxSum from '@ProblemSolving/Algorithms/Warmup/Mini-Max Sum'; +import plusMinus from '@ProblemSolving/Algorithms/Warmup/Plus Minus'; +import simpleArraySum from '@ProblemSolving/Algorithms/Warmup/Simple Array Sum'; +import solveMeFirst from '@ProblemSolving/Algorithms/Warmup/Solve Me First'; +import staircase from '@ProblemSolving/Algorithms/Warmup/Staircase'; +import timeConversion from '@ProblemSolving/Algorithms/Warmup/Time Conversion'; export { aVeryBigSum, @@ -20,4 +20,4 @@ export { solveMeFirst, staircase, timeConversion, -} +}; diff --git a/src/helpers.ts b/src/helpers.ts index 8c6b016..cec8aae 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -1,48 +1,48 @@ -import { NestedArray } from '@Types' +import { NestedArray } from '@Types'; export const toFlatArray = (arr: NestedArray): T[] => arr.reduce( (acc: T[], cur) => acc.concat(Array.isArray(cur) ? toFlatArray(cur) : cur), [] - ) + ); export const recursiveSum = ( start = 0, depth = 0, additions: number[] = [] ) => { - if (!depth || !additions.length) return [start] - const result: NestedArray = [] + if (!depth || !additions.length) return [start]; + const result: NestedArray = []; for (const addition of additions) - result.push(recursiveSum(start + addition, depth - 1, additions)) - const uniqueValues = new Set(toFlatArray(result)) + result.push(recursiveSum(start + addition, depth - 1, additions)); + const uniqueValues = new Set(toFlatArray(result)); const sortedValuesArr: number[] = Array.from(uniqueValues).sort( (x, y) => x - y - ) - return sortedValuesArr -} + ); + return sortedValuesArr; +}; export const countDuplicates = (arr: number[]) => arr.reduce((acc: Record, cur) => { - acc[cur] ? acc[cur]++ : (acc[cur] = 1) - return acc - }, {}) + acc[cur] ? acc[cur]++ : (acc[cur] = 1); + return acc; + }, {}); export const reverseNum = (num: number) => - parseFloat(num.toString().split('').reverse().join('')) + parseFloat(num.toString().split('').reverse().join('')); export const getLongestCommonSubStr = (x: string, y: string) => { - const maxStr = y.length > x.length ? y : x - const minStr = x.length < y.length ? x : y + const maxStr = y.length > x.length ? y : x; + const minStr = x.length < y.length ? x : y; let str = '', - tempSubstr: string + tempSubstr: string; for (let i = 0; i < minStr.length; i++) { for (let j = i + 1; j <= minStr.length; j++) { - tempSubstr = minStr.slice(i, j) + tempSubstr = minStr.slice(i, j); if (maxStr.includes(tempSubstr) && tempSubstr.length > str.length) - str = tempSubstr + str = tempSubstr; } } - return str -} + return str; +}; diff --git a/src/types.ts b/src/types.ts index d9ffc36..14db9dc 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1 +1 @@ -export type NestedArray = (T | NestedArray)[] +export type NestedArray = (T | NestedArray)[]; diff --git a/tsconfig.json b/tsconfig.json index 43bf18a..b304199 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,5 +20,5 @@ } }, "include": ["src/**/*"], - "exclude": ["**/*.test.ts"] + "exclude": ["docs", "**/*.test.ts"] } diff --git a/typedoc.json b/typedoc.json new file mode 100644 index 0000000..7350a16 --- /dev/null +++ b/typedoc.json @@ -0,0 +1,17 @@ +{ + "entryPoints": ["src"], + "entryPointStrategy": "expand", + "out": "docs", + "exclude": [ + "./src/**/*+(test).ts", + "./src/Problem Solving/Algorithms/Implementation/index.ts", + "./src/Problem Solving/Algorithms/Sorting/index.ts", + "./src/Problem Solving/Algorithms/Strings/index.ts", + "./src/Problem Solving/Algorithms/Warmup/index.ts" + ], + "plugin": ["typedoc-plugin-rename-defaults"], + "navigationLinks": { + "GitHub": "https://github.com/AndrewMamdouh/HackerRank" + }, + "name": "HackerRank Solution" +} diff --git a/yarn.lock b/yarn.lock index 98817dc..58ce0cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -40,6 +40,16 @@ __metadata: languageName: node linkType: hard +"@babel/code-frame@npm:^7.22.13, @babel/code-frame@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/code-frame@npm:7.24.7" + dependencies: + "@babel/highlight": "npm:^7.24.7" + picocolors: "npm:^1.0.0" + checksum: 10c0/ab0af539473a9f5aeaac7047e377cb4f4edd255a81d84a76058595f8540784cc3fbe8acf73f1e073981104562490aabfb23008cd66dc677a456a4ed5390fdde6 + languageName: node + linkType: hard + "@babel/compat-data@npm:^7.22.9": version: 7.22.9 resolution: "@babel/compat-data@npm:7.22.9" @@ -70,7 +80,7 @@ __metadata: languageName: node linkType: hard -"@babel/generator@npm:^7.22.7, @babel/generator@npm:^7.22.9, @babel/generator@npm:^7.7.2": +"@babel/generator@npm:^7.22.9, @babel/generator@npm:^7.7.2": version: 7.22.9 resolution: "@babel/generator@npm:7.22.9" dependencies: @@ -82,6 +92,18 @@ __metadata: languageName: node linkType: hard +"@babel/generator@npm:^7.23.0": + version: 7.25.5 + resolution: "@babel/generator@npm:7.25.5" + dependencies: + "@babel/types": "npm:^7.25.4" + "@jridgewell/gen-mapping": "npm:^0.3.5" + "@jridgewell/trace-mapping": "npm:^0.3.25" + jsesc: "npm:^2.5.1" + checksum: 10c0/eb8af30c39476e4f4d6b953f355fcf092258291f78d65fb759b7d5e5e6fd521b5bfee64a4e2e4290279f0dcd25ccf8c49a61807828b99b5830d2b734506da1fd + languageName: node + linkType: hard + "@babel/helper-compilation-targets@npm:^7.22.9": version: 7.22.9 resolution: "@babel/helper-compilation-targets@npm:7.22.9" @@ -97,6 +119,15 @@ __metadata: languageName: node linkType: hard +"@babel/helper-environment-visitor@npm:^7.22.20": + version: 7.24.7 + resolution: "@babel/helper-environment-visitor@npm:7.24.7" + dependencies: + "@babel/types": "npm:^7.24.7" + checksum: 10c0/36ece78882b5960e2d26abf13cf15ff5689bf7c325b10a2895a74a499e712de0d305f8d78bb382dd3c05cfba7e47ec98fe28aab5674243e0625cd38438dd0b2d + languageName: node + linkType: hard + "@babel/helper-environment-visitor@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-environment-visitor@npm:7.22.5" @@ -104,13 +135,13 @@ __metadata: languageName: node linkType: hard -"@babel/helper-function-name@npm:^7.22.5": - version: 7.22.5 - resolution: "@babel/helper-function-name@npm:7.22.5" +"@babel/helper-function-name@npm:^7.23.0": + version: 7.24.7 + resolution: "@babel/helper-function-name@npm:7.24.7" dependencies: - "@babel/template": "npm:^7.22.5" - "@babel/types": "npm:^7.22.5" - checksum: 10c0/3ce2e87967fe54aa463d279150ddda0dae3b5bc3f8c2773b90670b553b61e8fe62da7edcd7b1e1891c5b25af4924a6700dad2e9d8249b910a5bf7caa2eaf4c13 + "@babel/template": "npm:^7.24.7" + "@babel/types": "npm:^7.24.7" + checksum: 10c0/e5e41e6cf86bd0f8bf272cbb6e7c5ee0f3e9660414174435a46653efba4f2479ce03ce04abff2aa2ef9359cf057c79c06cb7b134a565ad9c0e8a50dcdc3b43c4 languageName: node linkType: hard @@ -186,6 +217,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-string-parser@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/helper-string-parser@npm:7.24.8" + checksum: 10c0/6361f72076c17fabf305e252bf6d580106429014b3ab3c1f5c4eb3e6d465536ea6b670cc0e9a637a77a9ad40454d3e41361a2909e70e305116a23d68ce094c08 + languageName: node + linkType: hard + "@babel/helper-validator-identifier@npm:^7.22.20": version: 7.22.20 resolution: "@babel/helper-validator-identifier@npm:7.22.20" @@ -200,6 +238,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-validator-identifier@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-validator-identifier@npm:7.24.7" + checksum: 10c0/87ad608694c9477814093ed5b5c080c2e06d44cb1924ae8320474a74415241223cc2a725eea2640dd783ff1e3390e5f95eede978bc540e870053152e58f1d651 + languageName: node + linkType: hard + "@babel/helper-validator-option@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-validator-option@npm:7.22.5" @@ -229,6 +274,18 @@ __metadata: languageName: node linkType: hard +"@babel/highlight@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/highlight@npm:7.24.7" + dependencies: + "@babel/helper-validator-identifier": "npm:^7.24.7" + chalk: "npm:^2.4.2" + js-tokens: "npm:^4.0.0" + picocolors: "npm:^1.0.0" + checksum: 10c0/674334c571d2bb9d1c89bdd87566383f59231e16bcdcf5bb7835babdf03c9ae585ca0887a7b25bdf78f303984af028df52831c7989fecebb5101cc132da9393a + languageName: node + linkType: hard + "@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.22.5, @babel/parser@npm:^7.22.7": version: 7.22.7 resolution: "@babel/parser@npm:7.22.7" @@ -238,6 +295,17 @@ __metadata: languageName: node linkType: hard +"@babel/parser@npm:^7.23.0, @babel/parser@npm:^7.25.0": + version: 7.25.4 + resolution: "@babel/parser@npm:7.25.4" + dependencies: + "@babel/types": "npm:^7.25.4" + bin: + parser: ./bin/babel-parser.js + checksum: 10c0/bdada5662f15d1df11a7266ec3bc9bb769bf3637ecf3d051eafcfc8f576dcf5a3ac1007c5e059db4a1e1387db9ae9caad239fc4f79e4c2200930ed610e779993 + languageName: node + linkType: hard + "@babel/plugin-syntax-async-generators@npm:^7.8.4": version: 7.8.4 resolution: "@babel/plugin-syntax-async-generators@npm:7.8.4" @@ -403,21 +471,32 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.22.6, @babel/traverse@npm:^7.22.8": - version: 7.22.8 - resolution: "@babel/traverse@npm:7.22.8" +"@babel/template@npm:^7.24.7": + version: 7.25.0 + resolution: "@babel/template@npm:7.25.0" dependencies: - "@babel/code-frame": "npm:^7.22.5" - "@babel/generator": "npm:^7.22.7" - "@babel/helper-environment-visitor": "npm:^7.22.5" - "@babel/helper-function-name": "npm:^7.22.5" + "@babel/code-frame": "npm:^7.24.7" + "@babel/parser": "npm:^7.25.0" + "@babel/types": "npm:^7.25.0" + checksum: 10c0/4e31afd873215744c016e02b04f43b9fa23205d6d0766fb2e93eb4091c60c1b88897936adb895fb04e3c23de98dfdcbe31bc98daaa1a4e0133f78bb948e1209b + languageName: node + linkType: hard + +"@babel/traverse@npm:7.23.2": + version: 7.23.2 + resolution: "@babel/traverse@npm:7.23.2" + dependencies: + "@babel/code-frame": "npm:^7.22.13" + "@babel/generator": "npm:^7.23.0" + "@babel/helper-environment-visitor": "npm:^7.22.20" + "@babel/helper-function-name": "npm:^7.23.0" "@babel/helper-hoist-variables": "npm:^7.22.5" "@babel/helper-split-export-declaration": "npm:^7.22.6" - "@babel/parser": "npm:^7.22.7" - "@babel/types": "npm:^7.22.5" + "@babel/parser": "npm:^7.23.0" + "@babel/types": "npm:^7.23.0" debug: "npm:^4.1.0" globals: "npm:^11.1.0" - checksum: 10c0/839014824c210388ed46f92bf5265522bd5bbb4a9a03c700f9d79b151bdd0aa077c2f6448a0cef41132188cc2bc6d8cdcad98a297ba59983401e882bdc256b1f + checksum: 10c0/d096c7c4bab9262a2f658298a3c630ae4a15a10755bb257ae91d5ab3e3b2877438934859c8d34018b7727379fe6b26c4fa2efc81cf4c462a7fe00caf79fa02ff languageName: node linkType: hard @@ -432,6 +511,17 @@ __metadata: languageName: node linkType: hard +"@babel/types@npm:^7.23.0, @babel/types@npm:^7.24.7, @babel/types@npm:^7.25.0, @babel/types@npm:^7.25.4": + version: 7.25.4 + resolution: "@babel/types@npm:7.25.4" + dependencies: + "@babel/helper-string-parser": "npm:^7.24.8" + "@babel/helper-validator-identifier": "npm:^7.24.7" + to-fast-properties: "npm:^2.0.0" + checksum: 10c0/9aa25dfcd89cc4e4dde3188091c34398a005a49e2c2b069d0367b41e1122c91e80fd92998c52a90f2fb500f7e897b6090ec8be263d9cb53d0d75c756f44419f2 + languageName: node + linkType: hard + "@babel/types@npm:^7.8.3": version: 7.24.0 resolution: "@babel/types@npm:7.24.0" @@ -801,6 +891,17 @@ __metadata: languageName: node linkType: hard +"@jridgewell/gen-mapping@npm:^0.3.5": + version: 0.3.5 + resolution: "@jridgewell/gen-mapping@npm:0.3.5" + dependencies: + "@jridgewell/set-array": "npm:^1.2.1" + "@jridgewell/sourcemap-codec": "npm:^1.4.10" + "@jridgewell/trace-mapping": "npm:^0.3.24" + checksum: 10c0/1be4fd4a6b0f41337c4f5fdf4afc3bd19e39c3691924817108b82ffcb9c9e609c273f936932b9fba4b3a298ce2eb06d9bff4eb1cc3bd81c4f4ee1b4917e25feb + languageName: node + linkType: hard + "@jridgewell/resolve-uri@npm:3.1.0": version: 3.1.0 resolution: "@jridgewell/resolve-uri@npm:3.1.0" @@ -815,6 +916,13 @@ __metadata: languageName: node linkType: hard +"@jridgewell/resolve-uri@npm:^3.1.0": + version: 3.1.2 + resolution: "@jridgewell/resolve-uri@npm:3.1.2" + checksum: 10c0/d502e6fb516b35032331406d4e962c21fe77cdf1cbdb49c6142bcbd9e30507094b18972778a6e27cbad756209cfe34b1a27729e6fa08a2eb92b33943f680cf1e + languageName: node + linkType: hard + "@jridgewell/set-array@npm:^1.0.1": version: 1.1.2 resolution: "@jridgewell/set-array@npm:1.1.2" @@ -822,6 +930,13 @@ __metadata: languageName: node linkType: hard +"@jridgewell/set-array@npm:^1.2.1": + version: 1.2.1 + resolution: "@jridgewell/set-array@npm:1.2.1" + checksum: 10c0/2a5aa7b4b5c3464c895c802d8ae3f3d2b92fcbe84ad12f8d0bfbb1f5ad006717e7577ee1fd2eac00c088abe486c7adb27976f45d2941ff6b0b92b2c3302c60f4 + languageName: node + linkType: hard + "@jridgewell/sourcemap-codec@npm:1.4.14": version: 1.4.14 resolution: "@jridgewell/sourcemap-codec@npm:1.4.14" @@ -836,6 +951,13 @@ __metadata: languageName: node linkType: hard +"@jridgewell/sourcemap-codec@npm:^1.4.14": + version: 1.5.0 + resolution: "@jridgewell/sourcemap-codec@npm:1.5.0" + checksum: 10c0/2eb864f276eb1096c3c11da3e9bb518f6d9fc0023c78344cdc037abadc725172c70314bdb360f2d4b7bffec7f5d657ce006816bc5d4ecb35e61b66132db00c18 + languageName: node + linkType: hard + "@jridgewell/trace-mapping@npm:0.3.9": version: 0.3.9 resolution: "@jridgewell/trace-mapping@npm:0.3.9" @@ -856,6 +978,16 @@ __metadata: languageName: node linkType: hard +"@jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.25": + version: 0.3.25 + resolution: "@jridgewell/trace-mapping@npm:0.3.25" + dependencies: + "@jridgewell/resolve-uri": "npm:^3.1.0" + "@jridgewell/sourcemap-codec": "npm:^1.4.14" + checksum: 10c0/3d1ce6ebc69df9682a5a8896b414c6537e428a1d68b02fcc8363b04284a8ca0df04d0ee3013132252ab14f2527bc13bea6526a912ecb5658f0e39fd2860b4df4 + languageName: node + linkType: hard + "@nodelib/fs.scandir@npm:2.1.5": version: 2.1.5 resolution: "@nodelib/fs.scandir@npm:2.1.5" @@ -883,6 +1015,13 @@ __metadata: languageName: node linkType: hard +"@nolyfill/is-core-module@npm:1.0.39": + version: 1.0.39 + resolution: "@nolyfill/is-core-module@npm:1.0.39" + checksum: 10c0/34ab85fdc2e0250879518841f74a30c276bca4f6c3e13526d2d1fe515e1adf6d46c25fcd5989d22ea056d76f7c39210945180b4859fc83b050e2da411aa86289 + languageName: node + linkType: hard + "@npmcli/agent@npm:^2.0.0": version: 2.2.2 resolution: "@npmcli/agent@npm:2.2.2" @@ -912,6 +1051,13 @@ __metadata: languageName: node linkType: hard +"@pkgr/core@npm:^0.1.0": + version: 0.1.1 + resolution: "@pkgr/core@npm:0.1.1" + checksum: 10c0/3f7536bc7f57320ab2cf96f8973664bef624710c403357429fbf680a5c3b4843c1dbd389bb43daa6b1f6f1f007bb082f5abcb76bb2b5dc9f421647743b71d3d8 + languageName: node + linkType: hard + "@sinclair/typebox@npm:^0.27.8": version: 0.27.8 resolution: "@sinclair/typebox@npm:0.27.8" @@ -953,6 +1099,20 @@ __metadata: languageName: node linkType: hard +"@trunkio/launcher@npm:^1.3.1": + version: 1.3.1 + resolution: "@trunkio/launcher@npm:1.3.1" + dependencies: + semver: "npm:^7.5.4" + tar: "npm:^6.2.0" + yaml: "npm:^2.2.0" + bin: + trunk: trunk.js + trunk_bash: trunk + checksum: 10c0/1d91cfb172e008705cce93725d100e9ad31d028291d45cf9ebbd60cc4ad56b0c5c3d23dfe20f4cfa874737191e241c866e09af77672aa933b8e0f63bd5298aff + languageName: node + linkType: hard + "@tsconfig/node10@npm:^1.0.7": version: 1.0.9 resolution: "@tsconfig/node10@npm:1.0.9" @@ -1739,12 +1899,12 @@ __metadata: languageName: node linkType: hard -"braces@npm:^3.0.2": - version: 3.0.2 - resolution: "braces@npm:3.0.2" +"braces@npm:3.0.3": + version: 3.0.3 + resolution: "braces@npm:3.0.3" dependencies: - fill-range: "npm:^7.0.1" - checksum: 10c0/321b4d675791479293264019156ca322163f02dc06e3c4cab33bb15cd43d80b51efef69b0930cfde3acd63d126ebca24cd0544fa6f261e093a0fb41ab9dda381 + fill-range: "npm:^7.1.1" + checksum: 10c0/7c6dfd30c338d2997ba77500539227b9d1f85e388a5f43220865201e407e076783d0881f2d297b9f80951b4c957fcf0b51c1d2d24227631643c3f7c284b0aa04 languageName: node linkType: hard @@ -1850,6 +2010,13 @@ __metadata: languageName: node linkType: hard +"camelcase@npm:^8.0.0": + version: 8.0.0 + resolution: "camelcase@npm:8.0.0" + checksum: 10c0/56c5fe072f0523c9908cdaac21d4a3b3fb0f608fb2e9ba90a60e792b95dd3bb3d1f3523873ab17d86d146e94171305f73ef619e2f538bd759675bc4a14b4bff3 + languageName: node + linkType: hard + "caniuse-lite@npm:^1.0.30001517": version: 1.0.30001518 resolution: "caniuse-lite@npm:1.0.30001518" @@ -1857,7 +2024,7 @@ __metadata: languageName: node linkType: hard -"chalk@npm:^2.0.0": +"chalk@npm:^2.0.0, chalk@npm:^2.4.2": version: 2.4.2 resolution: "chalk@npm:2.4.2" dependencies: @@ -2087,6 +2254,27 @@ __metadata: languageName: node linkType: hard +"debug@npm:^3.2.7": + version: 3.2.7 + resolution: "debug@npm:3.2.7" + dependencies: + ms: "npm:^2.1.1" + checksum: 10c0/37d96ae42cbc71c14844d2ae3ba55adf462ec89fd3a999459dec3833944cd999af6007ff29c780f1c61153bcaaf2c842d1e4ce1ec621e4fc4923244942e4a02a + languageName: node + linkType: hard + +"debug@npm:^4.3.5": + version: 4.3.6 + resolution: "debug@npm:4.3.6" + dependencies: + ms: "npm:2.1.2" + peerDependenciesMeta: + supports-color: + optional: true + checksum: 10c0/3293416bff072389c101697d4611c402a6bacd1900ac20c0492f61a9cdd6b3b29750fc7f5e299f8058469ef60ff8fb79b86395a30374fbd2490113c1c7112285 + languageName: node + linkType: hard + "decompress-response@npm:^6.0.0": version: 6.0.0 resolution: "decompress-response@npm:6.0.0" @@ -2235,6 +2423,16 @@ __metadata: languageName: node linkType: hard +"enhanced-resolve@npm:^5.15.0": + version: 5.17.1 + resolution: "enhanced-resolve@npm:5.17.1" + dependencies: + graceful-fs: "npm:^4.2.4" + tapable: "npm:^2.2.0" + checksum: 10c0/81a0515675eca17efdba2cf5bad87abc91a528fc1191aad50e275e74f045b41506167d420099022da7181c8d787170ea41e4a11a0b10b7a16f6237daecb15370 + languageName: node + linkType: hard + "env-paths@npm:^2.2.0": version: 2.2.1 resolution: "env-paths@npm:2.2.1" @@ -2286,6 +2484,54 @@ __metadata: languageName: node linkType: hard +"eslint-config-prettier@npm:^9.1.0": + version: 9.1.0 + resolution: "eslint-config-prettier@npm:9.1.0" + peerDependencies: + eslint: ">=7.0.0" + bin: + eslint-config-prettier: bin/cli.js + checksum: 10c0/6d332694b36bc9ac6fdb18d3ca2f6ac42afa2ad61f0493e89226950a7091e38981b66bac2b47ba39d15b73fff2cd32c78b850a9cf9eed9ca9a96bfb2f3a2f10d + languageName: node + linkType: hard + +"eslint-import-resolver-typescript@npm:^3.6.3": + version: 3.6.3 + resolution: "eslint-import-resolver-typescript@npm:3.6.3" + dependencies: + "@nolyfill/is-core-module": "npm:1.0.39" + debug: "npm:^4.3.5" + enhanced-resolve: "npm:^5.15.0" + eslint-module-utils: "npm:^2.8.1" + fast-glob: "npm:^3.3.2" + get-tsconfig: "npm:^4.7.5" + is-bun-module: "npm:^1.0.2" + is-glob: "npm:^4.0.3" + peerDependencies: + eslint: "*" + eslint-plugin-import: "*" + eslint-plugin-import-x: "*" + peerDependenciesMeta: + eslint-plugin-import: + optional: true + eslint-plugin-import-x: + optional: true + checksum: 10c0/5933b00791b7b077725b9ba9a85327d2e2dc7c8944c18a868feb317a0bf0e1e77aed2254c9c5e24dcc49360d119331d2c15281837f4269592965ace380a75111 + languageName: node + linkType: hard + +"eslint-module-utils@npm:^2.8.1": + version: 2.8.2 + resolution: "eslint-module-utils@npm:2.8.2" + dependencies: + debug: "npm:^3.2.7" + peerDependenciesMeta: + eslint: + optional: true + checksum: 10c0/98c5ca95db75507b148c05d157b287116c677bfc9ca6bef4d5455c8b199eb2c35b9204a15ca7a3497085daef8ca3a3f579bd9e753ad4ad4df6256e4ef1107c51 + languageName: node + linkType: hard + "eslint-plugin-jest@npm:^28.2.0": version: 28.2.0 resolution: "eslint-plugin-jest@npm:28.2.0" @@ -2304,6 +2550,48 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-prettier@npm:^5.2.1": + version: 5.2.1 + resolution: "eslint-plugin-prettier@npm:5.2.1" + dependencies: + prettier-linter-helpers: "npm:^1.0.0" + synckit: "npm:^0.9.1" + peerDependencies: + "@types/eslint": ">=8.0.0" + eslint: ">=8.0.0" + eslint-config-prettier: "*" + prettier: ">=3.0.0" + peerDependenciesMeta: + "@types/eslint": + optional: true + eslint-config-prettier: + optional: true + checksum: 10c0/4bc8bbaf5bb556c9c501dcdff369137763c49ccaf544f9fa91400360ed5e3a3f1234ab59690e06beca5b1b7e6f6356978cdd3b02af6aba3edea2ffe69ca6e8b2 + languageName: node + linkType: hard + +"eslint-plugin-simple-import-sort@npm:^12.1.1": + version: 12.1.1 + resolution: "eslint-plugin-simple-import-sort@npm:12.1.1" + peerDependencies: + eslint: ">=5.0.0" + checksum: 10c0/0ad1907ad9ddbadd1db655db0a9d0b77076e274b793a77b982c8525d808d868e6ecfce24f3a411e8a1fa551077387f9ebb38c00956073970ebd7ee6a029ce2b3 + languageName: node + linkType: hard + +"eslint-plugin-unused-imports@npm:^4.1.3": + version: 4.1.3 + resolution: "eslint-plugin-unused-imports@npm:4.1.3" + peerDependencies: + "@typescript-eslint/eslint-plugin": ^8.0.0-0 || ^7.0.0 || ^6.0.0 || ^5.0.0 + eslint: ^9.0.0 || ^8.0.0 + peerDependenciesMeta: + "@typescript-eslint/eslint-plugin": + optional: true + checksum: 10c0/e30120e274554b99756fb4c2af123ca03f502fc55bc7e5b095fa9278b96cb32f1e405cf2e533aa8b0f8ca28c504ecf15daed9e4b5fccb172316e256a994fdebe + languageName: node + linkType: hard + "eslint-scope@npm:^7.2.2": version: 7.2.2 resolution: "eslint-scope@npm:7.2.2" @@ -2473,7 +2761,14 @@ __metadata: languageName: node linkType: hard -"fast-glob@npm:^3.2.2, fast-glob@npm:^3.2.9": +"fast-diff@npm:^1.1.2": + version: 1.3.0 + resolution: "fast-diff@npm:1.3.0" + checksum: 10c0/5c19af237edb5d5effda008c891a18a585f74bf12953be57923f17a3a4d0979565fc64dbc73b9e20926b9d895f5b690c618cbb969af0cf022e3222471220ad29 + languageName: node + linkType: hard + +"fast-glob@npm:^3.2.2, fast-glob@npm:^3.2.9, fast-glob@npm:^3.3.2": version: 3.3.2 resolution: "fast-glob@npm:3.3.2" dependencies: @@ -2527,12 +2822,12 @@ __metadata: languageName: node linkType: hard -"fill-range@npm:^7.0.1": - version: 7.0.1 - resolution: "fill-range@npm:7.0.1" +"fill-range@npm:^7.1.1": + version: 7.1.1 + resolution: "fill-range@npm:7.1.1" dependencies: to-regex-range: "npm:^5.0.1" - checksum: 10c0/7cdad7d426ffbaadf45aeb5d15ec675bbd77f7597ad5399e3d2766987ed20bda24d5fac64b3ee79d93276f5865608bb22344a26b9b1ae6c4d00bd94bf611623f + checksum: 10c0/b75b691bbe065472f38824f694c2f7449d7f5004aa950426a2c28f0306c60db9b880c0b0e4ed819997ffb882d1da02cfcfc819bddc94d71627f5269682edf018 languageName: node linkType: hard @@ -2584,6 +2879,17 @@ __metadata: languageName: node linkType: hard +"fs-extra@npm:11.1.1": + version: 11.1.1 + resolution: "fs-extra@npm:11.1.1" + dependencies: + graceful-fs: "npm:^4.2.0" + jsonfile: "npm:^6.0.1" + universalify: "npm:^2.0.0" + checksum: 10c0/a2480243d7dcfa7d723c5f5b24cf4eba02a6ccece208f1524a2fbde1c629492cfb9a59e4b6d04faff6fbdf71db9fdc8ef7f396417a02884195a625f5d8dc9427 + languageName: node + linkType: hard + "fs-minipass@npm:^2.0.0": version: 2.1.0 resolution: "fs-minipass@npm:2.1.0" @@ -2672,6 +2978,15 @@ __metadata: languageName: node linkType: hard +"get-tsconfig@npm:^4.7.5": + version: 4.7.6 + resolution: "get-tsconfig@npm:4.7.6" + dependencies: + resolve-pkg-maps: "npm:^1.0.0" + checksum: 10c0/2240e1b13e996dfbb947d177f422f83d09d1f93c9ce16959ebb3c2bdf8bdf4f04f98eba043859172da1685f9c7071091f0acfa964ebbe4780394d83b7dc3f58a + languageName: node + linkType: hard + "glob-parent@npm:^5.1.2": version: 5.1.2 resolution: "glob-parent@npm:5.1.2" @@ -2768,7 +3083,7 @@ __metadata: languageName: node linkType: hard -"graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": +"graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": version: 4.2.11 resolution: "graceful-fs@npm:4.2.11" checksum: 10c0/386d011a553e02bc594ac2ca0bd6d9e4c22d7fa8cfbfc448a6d148c59ea881b092db9dbe3547ae4b88e55f1b01f7c4a2ecc53b310c042793e63aa44cf6c257f2 @@ -2793,18 +3108,26 @@ __metadata: version: 0.0.0-use.local resolution: "hackerrank-solutions@workspace:." dependencies: + "@trunkio/launcher": "npm:^1.3.1" "@types/jest": "npm:^29.5.11" "@types/node": "npm:^20.10.8" "@typescript-eslint/eslint-plugin": "npm:^6.18.1" "@typescript-eslint/parser": "npm:^6.18.1" "@yarnpkg/sdks": "npm:^3.1.0" eslint: "npm:^8.56.0" + eslint-config-prettier: "npm:^9.1.0" + eslint-import-resolver-typescript: "npm:^3.6.3" eslint-plugin-jest: "npm:^28.2.0" + eslint-plugin-prettier: "npm:^5.2.1" + eslint-plugin-simple-import-sort: "npm:^12.1.1" + eslint-plugin-unused-imports: "npm:^4.1.3" jest: "npm:^29.7.0" prettier: "npm:^3.2.5" ts-jest: "npm:^29.1.1" ts-node: "npm:^10.9.2" - typedoc: "npm:^0.25.7" + typedoc: "npm:^0.25.13" + typedoc-plugin-rename-defaults: "npm:^0.7.0" + typedoc-theme-hierarchy: "npm:^4.1.2" typescript: "npm:^5.3.3" languageName: unknown linkType: soft @@ -2976,6 +3299,15 @@ __metadata: languageName: node linkType: hard +"is-bun-module@npm:^1.0.2": + version: 1.1.0 + resolution: "is-bun-module@npm:1.1.0" + dependencies: + semver: "npm:^7.6.3" + checksum: 10c0/17cae968c3fe08e2bd66f8477e4d5a166d6299b5e7ce5c7558355551c50267f77dd386297fada6b68e4a32f01ce8920b0423e4d258242ea463b45901ec474beb + languageName: node + linkType: hard + "is-core-module@npm:^2.11.0": version: 2.12.1 resolution: "is-core-module@npm:2.12.1" @@ -3664,6 +3996,19 @@ __metadata: languageName: node linkType: hard +"jsonfile@npm:^6.0.1": + version: 6.1.0 + resolution: "jsonfile@npm:6.1.0" + dependencies: + graceful-fs: "npm:^4.1.6" + universalify: "npm:^2.0.0" + dependenciesMeta: + graceful-fs: + optional: true + checksum: 10c0/4f95b5e8a5622b1e9e8f33c96b7ef3158122f595998114d1e7f03985649ea99cb3cd99ce1ed1831ae94c8c8543ab45ebd044207612f31a56fd08462140e46865 + languageName: node + linkType: hard + "keyv@npm:^4.0.0, keyv@npm:^4.5.3": version: 4.5.4 resolution: "keyv@npm:4.5.4" @@ -3849,13 +4194,13 @@ __metadata: languageName: node linkType: hard -"micromatch@npm:^4.0.2, micromatch@npm:^4.0.4": - version: 4.0.5 - resolution: "micromatch@npm:4.0.5" +"micromatch@npm:4.0.8": + version: 4.0.8 + resolution: "micromatch@npm:4.0.8" dependencies: - braces: "npm:^3.0.2" + braces: "npm:^3.0.3" picomatch: "npm:^2.3.1" - checksum: 10c0/3d6505b20f9fa804af5d8c596cb1c5e475b9b0cd05f652c5b56141cf941bd72adaeb7a436fda344235cef93a7f29b7472efc779fcdb83b478eab0867b95cdeff + checksum: 10c0/166fa6eb926b9553f32ef81f5f531d27b4ce7da60e5baf8c021d043b27a388fb95e46a8038d5045877881e673f8134122b59624d5cecbd16eb50a42e7a6b5ca8 languageName: node linkType: hard @@ -4007,6 +4352,13 @@ __metadata: languageName: node linkType: hard +"ms@npm:^2.1.1": + version: 2.1.3 + resolution: "ms@npm:2.1.3" + checksum: 10c0/d924b57e7312b3b63ad21fc5b3dc0af5e78d61a1fc7cfb5457edaf26326bf62be5307cc87ffb6862ef1c2b33b0233cdb5d4f01c4c958cc0d660948b65a287a48 + languageName: node + linkType: hard + "natural-compare@npm:^1.4.0": version: 1.4.0 resolution: "natural-compare@npm:1.4.0" @@ -4283,6 +4635,15 @@ __metadata: languageName: node linkType: hard +"prettier-linter-helpers@npm:^1.0.0": + version: 1.0.0 + resolution: "prettier-linter-helpers@npm:1.0.0" + dependencies: + fast-diff: "npm:^1.1.2" + checksum: 10c0/81e0027d731b7b3697ccd2129470ed9913ecb111e4ec175a12f0fcfab0096516373bf0af2fef132af50cafb0a905b74ff57996d615f59512bb9ac7378fcc64ab + languageName: node + linkType: hard + "prettier@npm:^3.2.5": version: 3.2.5 resolution: "prettier@npm:3.2.5" @@ -4419,6 +4780,13 @@ __metadata: languageName: node linkType: hard +"resolve-pkg-maps@npm:^1.0.0": + version: 1.0.0 + resolution: "resolve-pkg-maps@npm:1.0.0" + checksum: 10c0/fb8f7bbe2ca281a73b7ef423a1cbc786fb244bd7a95cbe5c3fba25b27d327150beca8ba02f622baea65919a57e061eb5005204daa5f93ed590d9b77463a567ab + languageName: node + linkType: hard + "resolve.exports@npm:^2.0.0": version: 2.0.2 resolution: "resolve.exports@npm:2.0.2" @@ -4533,6 +4901,15 @@ __metadata: languageName: node linkType: hard +"semver@npm:^7.6.3": + version: 7.6.3 + resolution: "semver@npm:7.6.3" + bin: + semver: bin/semver.js + checksum: 10c0/88f33e148b210c153873cb08cfe1e281d518aaa9a666d4d148add6560db5cd3c582f3a08ccb91f38d5f379ead256da9931234ed122057f40bb5766e65e58adaf + languageName: node + linkType: hard + "shebang-command@npm:^2.0.0": version: 2.0.0 resolution: "shebang-command@npm:2.0.0" @@ -4771,7 +5148,24 @@ __metadata: languageName: node linkType: hard -"tar@npm:^6.0.5, tar@npm:^6.1.11, tar@npm:^6.1.2": +"synckit@npm:^0.9.1": + version: 0.9.1 + resolution: "synckit@npm:0.9.1" + dependencies: + "@pkgr/core": "npm:^0.1.0" + tslib: "npm:^2.6.2" + checksum: 10c0/d8b89e1bf30ba3ffb469d8418c836ad9c0c062bf47028406b4d06548bc66af97155ea2303b96c93bf5c7c0f0d66153a6fbd6924c76521b434e6a9898982abc2e + languageName: node + linkType: hard + +"tapable@npm:^2.2.0": + version: 2.2.1 + resolution: "tapable@npm:2.2.1" + checksum: 10c0/bc40e6efe1e554d075469cedaba69a30eeb373552aaf41caeaaa45bf56ffacc2674261b106245bd566b35d8f3329b52d838e851ee0a852120acae26e622925c9 + languageName: node + linkType: hard + +"tar@npm:^6.0.5, tar@npm:^6.1.11, tar@npm:^6.1.2, tar@npm:^6.2.0": version: 6.2.1 resolution: "tar@npm:6.2.1" dependencies: @@ -4927,6 +5321,13 @@ __metadata: languageName: node linkType: hard +"tslib@npm:^2.6.2": + version: 2.7.0 + resolution: "tslib@npm:2.7.0" + checksum: 10c0/469e1d5bf1af585742128827000711efa61010b699cb040ab1800bcd3ccdd37f63ec30642c9e07c4439c1db6e46345582614275daca3e0f4abae29b0083f04a6 + languageName: node + linkType: hard + "tunnel@npm:^0.0.6": version: 0.0.6 resolution: "tunnel@npm:0.0.6" @@ -4971,19 +5372,41 @@ __metadata: languageName: node linkType: hard -"typedoc@npm:^0.25.7": - version: 0.25.7 - resolution: "typedoc@npm:0.25.7" +"typedoc-plugin-rename-defaults@npm:^0.7.0": + version: 0.7.0 + resolution: "typedoc-plugin-rename-defaults@npm:0.7.0" + dependencies: + camelcase: "npm:^8.0.0" + peerDependencies: + typedoc: 0.22.x || 0.23.x || 0.24.x || 0.25.x + checksum: 10c0/2ae2065769ad9c7ea0100ebcc878056c29e79df42b3a4993d83b82d670d30e386f10d42320e228033bc351b191a9da950a5d9cba5595c1e2ae136ffce09bfbe8 + languageName: node + linkType: hard + +"typedoc-theme-hierarchy@npm:^4.1.2": + version: 4.1.2 + resolution: "typedoc-theme-hierarchy@npm:4.1.2" + dependencies: + fs-extra: "npm:11.1.1" + peerDependencies: + typedoc: ^0.24.0 || ^0.25.0 + checksum: 10c0/6ef49ec8db013d0c095bb7c069ee63bcb6107e45f234a19a7bf88b2c965d85bd39f832d00e7a058b49de9b98b9c83527b8bcf0eba79e5b806c061d15806a0c2f + languageName: node + linkType: hard + +"typedoc@npm:^0.25.13": + version: 0.25.13 + resolution: "typedoc@npm:0.25.13" dependencies: lunr: "npm:^2.3.9" marked: "npm:^4.3.0" minimatch: "npm:^9.0.3" shiki: "npm:^0.14.7" peerDependencies: - typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x + typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x bin: typedoc: bin/typedoc - checksum: 10c0/e663be0534dd56f45f041a478ee0613a1bf96cad7208a5cfc771981c904d0f30d8dca51956486f125f8004237264acc5dd45920fa6a0a32e351e36d74279abb1 + checksum: 10c0/13878e6a9fc2b65d65e3b514efa11b43bdfd57149861cefc4a969ec213f4bc4b36ee9239d0b654ae18bcbbd5174206d409383f9000b7bdea22da1945f7ac91de languageName: node linkType: hard @@ -5032,6 +5455,13 @@ __metadata: languageName: node linkType: hard +"universalify@npm:^2.0.0": + version: 2.0.1 + resolution: "universalify@npm:2.0.1" + checksum: 10c0/73e8ee3809041ca8b818efb141801a1004e3fc0002727f1531f4de613ea281b494a40909596dae4a042a4fb6cd385af5d4db2e137b1362e0e91384b828effd3a + languageName: node + linkType: hard + "update-browserslist-db@npm:^1.0.11": version: 1.0.11 resolution: "update-browserslist-db@npm:1.0.11" @@ -5178,6 +5608,15 @@ __metadata: languageName: node linkType: hard +"yaml@npm:^2.2.0": + version: 2.5.0 + resolution: "yaml@npm:2.5.0" + bin: + yaml: bin.mjs + checksum: 10c0/771a1df083c8217cf04ef49f87244ae2dd7d7457094425e793b8f056159f167602ce172aa32d6bca21f787d24ec724aee3cecde938f6643564117bd151452631 + languageName: node + linkType: hard + "yargs-parser@npm:^21.0.1, yargs-parser@npm:^21.1.1": version: 21.1.1 resolution: "yargs-parser@npm:21.1.1"