From 1034cd5c9497d401c0c4b51e8dbce63c861d41ae Mon Sep 17 00:00:00 2001 From: Stedd Date: Sun, 1 Dec 2024 13:46:54 +0100 Subject: [PATCH] need to use absolute value to get the correct distance between the IDs --- days/day01.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/days/day01.cpp b/days/day01.cpp index ed97b59..004a53a 100644 --- a/days/day01.cpp +++ b/days/day01.cpp @@ -107,6 +107,6 @@ void day01::Run() for (int i = 0; i < col1.size(); ++i) { - sum+= col1[i]-col2[i]; + sum += std::abs(col1[i] - col2[i]); } }