move into year directory

This commit is contained in:
2024-12-01 09:19:58 +01:00
parent 83f3eac294
commit 0c0c7cc89d
49 changed files with 0 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
import { open } from 'node:fs/promises';
function getHash(input: string) {
let curr = 0
for (var i = 0; i < input.length; i++) {
curr += input.charCodeAt(i)
curr *= 17
curr %= 256
}
return curr
}
const file = await open('./inputs/15');
for await (const line of file.readLines()) {
console.log(line.split(',').map(getHash).reduce((acc, cur) => acc + cur, 0))
}
console.log(getHash('rn'))