Multiple exercises were added to the TypeScript track in this commit.

This commit is contained in:
2025-04-16 21:10:33 +02:00
parent e0d01e1c8d
commit 83ec49cb5b
72 changed files with 81869 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
function step(count: number, interation: number): number {
if (count === 1) return interation
if (count % 2 === 0) { // Even
return step(count / 2, interation + 1)
} else {
return step((3 * count) + 1, interation + 1)
}
}
export function steps(count: number): number {
if (!count || count < 1 || Math.trunc(count) !== count)
throw new Error('Only positive integers are allowed')
return step(count, 0)
}