aboutsummaryrefslogtreecommitdiff
path: root/2025
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2025-12-03 17:57:57 +0100
committerThomas Schmucker <ts@its1.de>2025-12-03 17:57:57 +0100
commitc3635ea08f51888ccc09a8183babc0e4999c32dc (patch)
tree81e594cd20d069013bc2f2654ba332e12c32ce33 /2025
parent18e1c99982c72f429a21d0626b3f0a68fc51d04e (diff)
downloadadvent-of-code-c3635ea08f51888ccc09a8183babc0e4999c32dc.tar.gz
advent-of-code-c3635ea08f51888ccc09a8183babc0e4999c32dc.tar.bz2
advent-of-code-c3635ea08f51888ccc09a8183babc0e4999c32dc.zip
aoc 2025, day 3, part 2
Diffstat (limited to '2025')
-rw-r--r--2025/src/day03.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/2025/src/day03.cpp b/2025/src/day03.cpp
index c9db900..64851b9 100644
--- a/2025/src/day03.cpp
+++ b/2025/src/day03.cpp
@@ -34,9 +34,10 @@ solve(const vector<long>& line, int n)
34{ 34{
35 long value = 0; 35 long value = 0;
36 auto start = line.begin(); 36 auto start = line.begin();
37 auto end = prev(line.end(), n);
37 38
38 while ( n-- > 0 ) { 39 while ( n-- > 0 ) {
39 start = max_element(start, prev(line.end(), n)); 40 start = max_element(start, ++end);
40 41
41 value *= 10; 42 value *= 10;
42 value += *start++; 43 value += *start++;