commit 46ae00bccc5f4010b61b417af2c0de9cdabd0b0e Author: Joshua Seigler Date: Thu Dec 3 22:46:39 2020 -0500 Days 1-3 diff --git a/day01.js b/day01.js new file mode 100644 index 0000000..5558045 --- /dev/null +++ b/day01.js @@ -0,0 +1 @@ +let d=document.body.textContent.trim().split('\n').map(a=>parseInt(a)),s=0,f=(a,b,c=2)=>{for(let e,g,h=0;hl.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)]; \ No newline at end of file diff --git a/day03.js b/day03.js new file mode 100644 index 0000000..95ca691 --- /dev/null +++ b/day03.js @@ -0,0 +1,2 @@ +let d=document.body.textContent.trim().split(` +`);let t=(X,Y)=>{let c=0;for(let y=0,x=0;y