mirror of
https://github.com/seigler/advent-of-code-browser-console
synced 2025-07-27 00:26:10 +00:00
Remove newlines for twitter compatibility, tighten day 3
This commit is contained in:
parent
46ae00bccc
commit
db044959e3
2 changed files with 2 additions and 4 deletions
3
day02.js
3
day02.js
|
@ -1,2 +1 @@
|
|||
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)];
|
||||
let d=document.body.textContent.trim().split('\n').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