multiple improvements, day 5 progress

This commit is contained in:
Joshua Seigler 2021-12-06 11:40:44 -05:00
parent c3433467d8
commit 53f2b9aec4
5 changed files with 7 additions and 4 deletions

3
2021/day03.js Normal file
View file

@ -0,0 +1,3 @@
I=$('pre').innerText.trim().split`\n`;O=[];I.map(l=>[...l].map((x, i)=>{if(+x)O[i]=(O[i]||0)+1}))
g=t=>parseInt(O.reduce((a,p)=>a+(t^(p<I.length/2)?0:1),""),2);
[g(0)*g(1)]// just day 1 so far