Skip to content

Commit c0121dd

Browse files
committed
2024/01 writeup
1 parent 33e473b commit c0121dd

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

2024/Day01/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
## --- Day 1: Historian Hysteria ---
22
The <em>Chief Historian</em> is always present for the big Christmas sleigh launch, but nobody has seen him in months! Last anyone heard, he was visiting locations that are historically significant to the North Pole; a group of Senior Historians has asked you to accompany them as they check the places they think he was most likely to visit.
33

4-
As each location is checked, they will mark it on their list with a <em>star</em>. They figure the Chief Historian <em>must</em> be in one of the first fifty places they'll look, so in order to save Christmas, you need to help them get <em>fifty stars</em> on their list before Santa takes off on December 25th.
4+
Read the [full puzzle](https://adventofcode.com/2024/day/1).
55

6-
Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants <em>one star</em>. Good luck!
6+
Our warm-up puzzle involves list comparisons. It'll take me a bit of time to get back into C#, as I find it a bit noisy now, but anyway... The first half is simply calculating the pairwise differences between two lists. The second half involves summing the elements of the first list, weighted by their occurrences in the second list.
7+
8+
This is a much better starting point than last year's infamous `oneeight` puzzle!
79

8-
Read the [full puzzle](https://adventofcode.com/2024/day/1).

2024/Day01/Solution.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public object PartOne(string input) =>
1515
.Sum();
1616

1717
public object PartTwo(string input) {
18-
// sum the left column weighted by the number of occurrences in the right
18+
// sum the elements of the left column weighted by the its of occurrences in the right
1919
// ⭐ .Net 9 comes with a new CountBy function
2020
var numberCount = Column(input, 1).CountBy(x=>x).ToDictionary();
2121
return Column(input, 0).Select(num => numberCount.GetValueOrDefault(num) * num).Sum();

0 commit comments

Comments
 (0)