aboutsummaryrefslogtreecommitdiff
path: root/2024/src/day19.cpp
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2024-12-19 17:56:24 +0100
committerThomas Schmucker <ts@its1.de>2024-12-19 17:56:24 +0100
commit680e29b45dde4261eed8a0cde7949f1f90962a78 (patch)
treeedc2779a7e26a70ab27a105a638e84d50c6c14d0 /2024/src/day19.cpp
parentbe48946cd5f714ab5aa749aaa29d523f9c5460c3 (diff)
downloadadvent-of-code-680e29b45dde4261eed8a0cde7949f1f90962a78.tar.gz
advent-of-code-680e29b45dde4261eed8a0cde7949f1f90962a78.tar.bz2
advent-of-code-680e29b45dde4261eed8a0cde7949f1f90962a78.zip
aoc 2024, day 19, alternative Lösung
Diffstat (limited to '2024/src/day19.cpp')
-rw-r--r--2024/src/day19.cpp7
1 files changed, 2 insertions, 5 deletions
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<set<string>, vector<string>>& data)
92 92
93 long counter = 0; 93 long counter = 0;
94 for ( size_t i = 0; i != line.size(); ++i ) { 94 for ( size_t i = 0; i != line.size(); ++i ) {
95 auto lhs = line.substr(0, i + 1); 95 if ( parts.contains(line.substr(0, i + 1)) ) {
96 auto rhs = line.substr(i + 1); 96 counter += match(line.substr(i + 1));
97
98 if ( parts.contains(lhs) ) {
99 counter += match(rhs);
100 } 97 }
101 } 98 }
102 99