From 680e29b45dde4261eed8a0cde7949f1f90962a78 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Thu, 19 Dec 2024 17:56:24 +0100 Subject: aoc 2024, day 19, alternative Lösung MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2024/src/day19.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to '2024/src/day19.cpp') diff --git a/2024/src/day19.cpp b/2024/src/day19.cpp index 43995b1..c114d2a 100644 --- a/2024/src/day19.cpp +++ b/2024/src/day19.cpp @@ -92,11 +92,8 @@ part2(const tuple, vector>& data) long counter = 0; for ( size_t i = 0; i != line.size(); ++i ) { - auto lhs = line.substr(0, i + 1); - auto rhs = line.substr(i + 1); - - if ( parts.contains(lhs) ) { - counter += match(rhs); + if ( parts.contains(line.substr(0, i + 1)) ) { + counter += match(line.substr(i + 1)); } } -- cgit v1.3