#1672
Easy Algorithms Richest customer wealth
Array Matrix
88.7% acceptance
Feb 25, 2026
4854
389
You are given an m x n integer grid accounts where accounts[i][j] is the
amount of money the ith customer has in the jth bank.
Return the wealth that the richest customer has.
Solution
Rust
Time O(n)
Space O(1)
impl Solution {
pub fn maximum_wealth(accounts: Vec<Vec<i32>>) -> i32 {
accounts.iter().map(|row| row.iter().sum()).max().unwrap_or(0)
}
}