Skip to content

Commit d6a4399

Browse files
committed
getting the frequencies of time
1 parent 8a77e04 commit d6a4399

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const fs = require("fs");
2+
3+
// read the file
4+
let frequencies = fs.readFileSync("input.txt", "utf-8");
5+
6+
// split the numbers by next line and covert them into Number
7+
frequencies = frequencies.split("\n").map((num) => Number(num));
8+
9+
// reduce to get the total = 529
10+
console.log(frequencies.reduce((acc, num) => acc + num, 0));

0 commit comments

Comments
 (0)