From 30a13831b7e419bce3cf31a674f43e09e68575d8 Mon Sep 17 00:00:00 2001 From: SquidSpirit Date: Wed, 20 Aug 2025 02:03:32 +0800 Subject: [PATCH] feat: 3190_find_minimum_operations_to_make_all_elements_divisible_by_three --- .../Cargo.lock | 7 +++++++ .../Cargo.toml | 6 ++++++ .../src/lib.rs | 7 +++++++ 3 files changed, 20 insertions(+) create mode 100644 3190_find_minimum_operations_to_make_all_elements_divisible_by_three/Cargo.lock create mode 100644 3190_find_minimum_operations_to_make_all_elements_divisible_by_three/Cargo.toml create mode 100644 3190_find_minimum_operations_to_make_all_elements_divisible_by_three/src/lib.rs diff --git a/3190_find_minimum_operations_to_make_all_elements_divisible_by_three/Cargo.lock b/3190_find_minimum_operations_to_make_all_elements_divisible_by_three/Cargo.lock new file mode 100644 index 0000000..3d0f0d7 --- /dev/null +++ b/3190_find_minimum_operations_to_make_all_elements_divisible_by_three/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "find_minimum_operations_to_make_all_elements_divisible_by_three" +version = "0.1.0" diff --git a/3190_find_minimum_operations_to_make_all_elements_divisible_by_three/Cargo.toml b/3190_find_minimum_operations_to_make_all_elements_divisible_by_three/Cargo.toml new file mode 100644 index 0000000..a020d6c --- /dev/null +++ b/3190_find_minimum_operations_to_make_all_elements_divisible_by_three/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "find_minimum_operations_to_make_all_elements_divisible_by_three" +version = "0.1.0" +edition = "2024" + +[dependencies] diff --git a/3190_find_minimum_operations_to_make_all_elements_divisible_by_three/src/lib.rs b/3190_find_minimum_operations_to_make_all_elements_divisible_by_three/src/lib.rs new file mode 100644 index 0000000..65a3d47 --- /dev/null +++ b/3190_find_minimum_operations_to_make_all_elements_divisible_by_three/src/lib.rs @@ -0,0 +1,7 @@ +pub struct Solution; + +impl Solution { + pub fn minimum_operations(nums: Vec) -> i32 { + nums.iter().filter(|&num| num % 3 != 0).count() as i32 + } +}