Files
advent-of-code-2021/day_1/day_1.m
2021-12-01 18:54:04 +00:00

6 lines
182 B
Mathematica

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