From ba00e02c3a8b2351ccdc1ed9f0adbd117a8db435 Mon Sep 17 00:00:00 2001 From: Stedd Date: Sun, 1 Dec 2024 16:37:06 +0100 Subject: [PATCH] The if is not actually needed, I redundantly created the standard behaviour of unordered_map --- days/day01.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/days/day01.cpp b/days/day01.cpp index 1ddc224..80399f0 100644 --- a/days/day01.cpp +++ b/days/day01.cpp @@ -181,15 +181,8 @@ void day01::Part2() for (auto number: col2) { - if (occurrence_map.contains(number)) - { - occurrence_map[number]++; - } else - { - occurrence_map[number] = 1; - } + occurrence_map[number]++; } - for (auto number: col1) { sum += number * occurrence_map[number];