From e9eb2e6745f160ece8057c84e8ce0165a162d333 Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Raza Date: Tue, 26 Nov 2024 20:11:56 +0000 Subject: [PATCH] performance: iterate through only 3-digit numbers --- largest_palindrome_product.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/largest_palindrome_product.rs b/largest_palindrome_product.rs index 4121c08..876b363 100644 --- a/largest_palindrome_product.rs +++ b/largest_palindrome_product.rs @@ -1,8 +1,8 @@ fn main() { let mut product: i64 = 0; - for i in 1..=999 { - for j in 1..=999 { + for i in 100..=999 { + for j in 100..=999 { let product_string: String = format!("{:?}", i * j); let reversed_string = product_string.chars().rev().collect::();