@@ -80,3 +80,55 @@ distances between all of the pairs you found. In the example above, this is `2 +
80
80
81
81
Your actual left and right lists contain many location IDs. What is the total
82
82
distance between your lists?
83
+
84
+ ## Part Two
85
+
86
+ Your analysis only confirmed what everyone feared: the two lists of location IDs
87
+ are indeed very different.
88
+
89
+ Or are they?
90
+
91
+ The Historians can't agree on which group made the mistakes or how to read most
92
+ of the Chief's handwriting, but in the commotion you notice an interesting
93
+ detail: a lot of location IDs appear in both lists! Maybe the other numbers
94
+ aren't location IDs at all but rather misinterpreted handwriting.
95
+
96
+ This time, you'll need to figure out exactly how often each number from the left
97
+ list appears in the right list. Calculate a total similarity score by adding up
98
+ each number in the left list after multiplying it by the number of times that
99
+ number appears in the right list.
100
+
101
+ Here are the same example lists again:
102
+
103
+ ```
104
+ 3 4
105
+ 4 3
106
+ 2 5
107
+ 1 3
108
+ 3 9
109
+ 3 3
110
+ ```
111
+
112
+ For these example lists, here is the process of finding the similarity score:
113
+
114
+ - The first number in the left list is ` 3 ` . It appears in the right list three
115
+ times, so the similarity score increases by ` 3 * 3 = 9 ` .
116
+
117
+ - The second number in the left list is ` 4 ` . It appears in the right list once,
118
+ so the similarity score increases by ` 4 * 1 = 4 ` .
119
+
120
+ - The third number in the left list is ` 2 ` . It does not appear in the right
121
+ list, so the similarity score does not increase (` 2 * 0 = 0 ` ).
122
+
123
+ - The fourth number, ` 1 ` , also does not appear in the right list.
124
+
125
+ - The fifth number, ` 3 ` , appears in the right list three times; the similarity
126
+ score increases by ` 9 ` .
127
+
128
+ - The last number, ` 3 ` , appears in the right list three times; the similarity
129
+ score again increases by ` 9 ` .
130
+
131
+ So, for these example lists, the similarity score at the end of this process is
132
+ ` 31 ` (` 9 + 4 + 0 + 0 + 9 + 9 ` ).
133
+
134
+ Once again consider your left and right lists. What is their similarity score?
0 commit comments