MCPcopy Create free account
hub / github.com/StudyRust/leetcode_rust / maximum_wealth

Function maximum_wealth

1672-richest-customer-wealth.rs:17–29  ·  view source on GitHub ↗

来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/richest-customer-wealth 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。

(accounts: Vec<Vec<i32>>)

Source from the content-addressed store, hash-verified

15// 链接:https://leetcode-cn.com/problems/richest-customer-wealth
16// 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
17pub fn maximum_wealth(accounts: Vec<Vec<i32>>) -> i32 {
18 let mut res = 0;
19 for account in accounts {
20 let mut current = 0;
21 for e in account {
22 current += e;
23 }
24 if current >= res {
25 res = current
26 }
27 }
28 res
29}

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected