Day 1 in Mathematica

This commit is contained in:
Smaug123
2021-12-01 18:54:04 +00:00
parent f5d7d1d40a
commit bb21ddca07
2 changed files with 6 additions and 0 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
**/target
.DS_Store
*.nb

5
day_1/day_1.m Normal file
View File

@@ -0,0 +1,5 @@
ints = ReadList[StringJoin[NotebookDirectory[], "/input.txt"], "Number"];
part1 = Tr@Clip[Differences@#, {0, 1}] &;
part2 = Tr@Boole[Less @@@ Partition[#, 4, 1][[All, {1, 4}]]] &;