diff --git a/math/111-999-two-digits-no-zero/solve-(idiomatic_rust)-huzwares.rs b/math/111-999-two-digits-no-zero/solve-(idiomatic_rust)-huzwares.rs new file mode 100644 index 0000000..e4a2465 --- /dev/null +++ b/math/111-999-two-digits-no-zero/solve-(idiomatic_rust)-huzwares.rs @@ -0,0 +1,12 @@ +use std::collections::HashSet; + +fn main() { + // Idiomatic Rust + let counter = (100..1000) + .filter(|&n| { + let n = n.to_string().chars().collect::>(); + !n.contains(&'0') && n.len() == 2 + }) + .count(); + println!("{counter}"); +}