mirror of
https://github.com/seigler/advent-of-code-browser-console
synced 2025-07-27 00:26:10 +00:00
Days 1-3
This commit is contained in:
commit
46ae00bccc
3 changed files with 5 additions and 0 deletions
2
day02.js
Normal file
2
day02.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
let d=document.body.textContent.trim().split(`
|
||||
`).map(l=>l.match(/(.+)-(.+) (.): (.+)$/));[d.reduce((s,[_,l,u,n,h])=>{const c=[...h.matchAll(RegExp(n,'g'))].length;return c<=u&&c>=l?s+1:s},0),d.reduce((s,[_,a,b,n,h])=>{return h[a-1]==n^h[b-1]==n?s+1:s},0)];
|
Loading…
Add table
Add a link
Reference in a new issue