From ed02a5e2cccda840a18eae3ca14875267b0a8d9b Mon Sep 17 00:00:00 2001 From: SquidSpirit Date: Wed, 20 Aug 2025 02:33:22 +0800 Subject: [PATCH] feat: 1672_richest_customer_wealth --- 1672_richest_customer_wealth/Cargo.lock | 7 +++++++ 1672_richest_customer_wealth/Cargo.toml | 6 ++++++ 1672_richest_customer_wealth/src/lib.rs | 11 +++++++++++ 3 files changed, 24 insertions(+) create mode 100644 1672_richest_customer_wealth/Cargo.lock create mode 100644 1672_richest_customer_wealth/Cargo.toml create mode 100644 1672_richest_customer_wealth/src/lib.rs diff --git a/1672_richest_customer_wealth/Cargo.lock b/1672_richest_customer_wealth/Cargo.lock new file mode 100644 index 0000000..805459d --- /dev/null +++ b/1672_richest_customer_wealth/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "richest_customer_wealth" +version = "0.1.0" diff --git a/1672_richest_customer_wealth/Cargo.toml b/1672_richest_customer_wealth/Cargo.toml new file mode 100644 index 0000000..380320d --- /dev/null +++ b/1672_richest_customer_wealth/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "richest_customer_wealth" +version = "0.1.0" +edition = "2024" + +[dependencies] diff --git a/1672_richest_customer_wealth/src/lib.rs b/1672_richest_customer_wealth/src/lib.rs new file mode 100644 index 0000000..3d3860a --- /dev/null +++ b/1672_richest_customer_wealth/src/lib.rs @@ -0,0 +1,11 @@ +pub struct Solution; + +impl Solution { + pub fn maximum_wealth(accounts: Vec>) -> i32 { + accounts + .iter() + .map(|assets| assets.iter().sum()) + .max() + .unwrap() + } +}