performance: iterate through only 3-digit numbers

This commit is contained in:
Muhammad Nauman Raza 2024-11-26 20:11:56 +00:00
parent 9430b8cfd2
commit e9eb2e6745
Signed by: devraza
GPG key ID: 91EAD6081011574B

View file

@ -1,8 +1,8 @@
fn main() { fn main() {
let mut product: i64 = 0; let mut product: i64 = 0;
for i in 1..=999 { for i in 100..=999 {
for j in 1..=999 { for j in 100..=999 {
let product_string: String = format!("{:?}", i * j); let product_string: String = format!("{:?}", i * j);
let reversed_string = product_string.chars().rev().collect::<String>(); let reversed_string = product_string.chars().rev().collect::<String>();