Last active
December 4, 2019 11:01
-
-
Save emplv/962af7309de6f64e74f918b10991f023 to your computer and use it in GitHub Desktop.
AoC 2019 - day 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const INPUT = ` | |
| COPY & PASTE HERE | |
| `.trim().split`,`; | |
| function doInstructions([...arr],one=12,two=2) { | |
| for(arr[1]=one,arr[2]=two,i=0;[o,a,b,t]=arr.slice(i),99-o||~'12'.search(o);i+=4)arr[t]=2==o?arr[a]*arr[b]:arr[a]- -arr[b]; | |
| return arr[0]; | |
| } | |
| // part 1 | |
| doInstructions(INPUT); | |
| //part 2 | |
| for(j=0;19690720!=doInstructions(INPUT,j/100|0,j++%100)&&j<1e4;)(j/100|0)*100+j%100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment