nieuw jaar
This commit is contained in:
14
src/2022/day1/example.txt
Normal file
14
src/2022/day1/example.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
1000
|
||||
2000
|
||||
3000
|
||||
|
||||
4000
|
||||
|
||||
5000
|
||||
6000
|
||||
|
||||
7000
|
||||
8000
|
||||
9000
|
||||
|
||||
10000
|
||||
17
src/2022/day1/index.ts
Normal file
17
src/2022/day1/index.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import * as fs from 'fs';
|
||||
import path from 'path';
|
||||
import {readFile} from "../../utils";
|
||||
|
||||
let input = readFile(path.resolve(__dirname, 'input.txt'));
|
||||
|
||||
const ans = Math.max(
|
||||
...input
|
||||
.split("\n\n")
|
||||
.map(a => a.split("\n"))
|
||||
.map(buck => buck
|
||||
.map(Number)
|
||||
.reduce((a, b) => a + b), 0)
|
||||
)
|
||||
|
||||
console.log(ans);
|
||||
|
||||
2242
src/2022/day1/input.txt
Normal file
2242
src/2022/day1/input.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user