From cbbdf1c07d629d2947659768110ccf2a6dc5066b Mon Sep 17 00:00:00 2001 From: Piotr Russ Date: Wed, 9 Dec 2020 23:45:11 +0100 Subject: day6 --- day6/day6-1.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 day6/day6-1.js (limited to 'day6/day6-1.js') diff --git a/day6/day6-1.js b/day6/day6-1.js new file mode 100644 index 0000000..cd21330 --- /dev/null +++ b/day6/day6-1.js @@ -0,0 +1,9 @@ +const data = require('./data') + +const repeats = data + .split(/\n{2,}/g) + .map(g => g.replace(/(^\n)|(\n$)/g,'').split('\n').map(s => s.split('')).flat()) + .map(a => [...new Set(a)].length) + .reduce((a, b) => a + b, 0) + +console.log(repeats) -- cgit v1.2.3