From d39cc86d4d10ed5c2215965200935b0d83dd2b5c Mon Sep 17 00:00:00 2001 From: timeshifter Date: Thu, 2 Jul 2026 15:24:20 +0200 Subject: [PATCH] clean up 16 --- day16/Cargo.toml | 3 +++ day16/src/main.rs | 12 +++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/day16/Cargo.toml b/day16/Cargo.toml index e6a15e1..3ec753f 100644 --- a/day16/Cargo.toml +++ b/day16/Cargo.toml @@ -5,3 +5,6 @@ edition = "2024" [dependencies] itertools = "*" + +[profile.release] +debug = true diff --git a/day16/src/main.rs b/day16/src/main.rs index a663391..7072207 100644 --- a/day16/src/main.rs +++ b/day16/src/main.rs @@ -19,16 +19,14 @@ fn main() { fn calculate_checksum(length: usize) { let mut a = INPUT.to_string(); while a.len() < length { - let mut b = a.clone(); - b = b - .chars() - .rev() - .map(|c| if c == '0' { '1' } else { '0' }) - .collect(); + let b = a.clone(); + let b_chars = b.chars().rev().map(|c| if c == '0' { '1' } else { '0' }); let mut result = a.clone(); result.push('0'); - result.push_str(&b); + for ch in b_chars { + result.push(ch); + } a = result; } a.truncate(length);