From 58b1076570f47a67cb391cada4230146ca567295 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 18 Jul 2024 00:33:39 -0500 Subject: [PATCH] Correct type to not truncate info or raise errors --- rust/src/p0008.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/src/p0008.rs b/rust/src/p0008.rs index 5852cf1b..2c582811 100644 --- a/rust/src/p0008.rs +++ b/rust/src/p0008.rs @@ -62,8 +62,8 @@ pub fn p0008() -> u64 { for i in 0..(string.len() - 13) { let slice = &string[i..(i + 13)]; let mut prod: u64 = 1; - for c in slice.chars() { - prod *= (c - '0') as u64; + for c in slice.bytes() { + prod *= (c as u32 - '0' as u32) as u64; } if prod > answer { answer = prod;