@@ -22,3 +22,35 @@ Example calculation:
22
22
- Total distance: 2+1+0+1+2+5 = 11
23
23
24
24
The puzzle asks you to perform this calculation on the actual input lists to determine the total distance.
25
+
26
+ --- Part Two ---
27
+
28
+ The puzzle now focuses on calculating a "similarity score" between two lists of numbers. The process is as follows:
29
+
30
+ For each number in the left list:
31
+
32
+ - Count how many times that number appears in the right list
33
+ - Multiply the number by its frequency in the right list
34
+ - Add this product to a running total (similarity score)
35
+
36
+ Key points:
37
+
38
+ - Numbers that don't appear in the right list contribute 0 to the score
39
+ - The score is calculated by multiplying each left list number by its frequency in the right list
40
+ - The goal is to find the total similarity score
41
+
42
+ Example calculation:
43
+
44
+ - Left list: [ 3, 4, 2, 1, 3, 3]
45
+ - Right list: [ 4, 3, 5, 3, 9, 3]
46
+ - Breakdown:
47
+ - 3 appears 3 times in right list: 3 * 3 = 9
48
+ - 4 appears 1 time in right list: 4 * 1 = 4
49
+ - 2 appears 0 times in right list: 2 * 0 = 0
50
+ - 1 appears 0 times in right list: 1 * 0 = 0
51
+ - 3 appears 3 times in right list: 3 * 3 = 9
52
+ - 3 appears 3 times in right list: 3 * 3 = 9
53
+
54
+ - Total similarity score: 9 + 4 + 0 + 0 + 9 + 9 = 31
55
+
56
+ The puzzle asks you to calculate this similarity score for the actual input lists.
0 commit comments