The if is not actually needed, I redundantly created the standard behaviour of unordered_map

This commit is contained in:
Stedd 2024-12-01 16:37:06 +01:00
parent 095ddd091e
commit ba00e02c3a
1 changed files with 1 additions and 8 deletions

View File

@ -180,16 +180,9 @@ void day01::Part2()
} }
for (auto number: col2) for (auto number: col2)
{
if (occurrence_map.contains(number))
{ {
occurrence_map[number]++; occurrence_map[number]++;
} else
{
occurrence_map[number] = 1;
} }
}
for (auto number: col1) for (auto number: col1)
{ {
sum += number * occurrence_map[number]; sum += number * occurrence_map[number];