1672. Richest Customer Wealth Easy

@problem@discussion
#Array#Matrix



1/**
2 * [1672] Richest Customer Wealth
3 *
4 * You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the i​​​​​^​​​​​​th​​​​ customer has in the j​​​​​^​​​​​​th​​​​ bank. Return the wealth that the richest customer has.
5 * A customer's wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth.
6 *  
7 * Example 1:
8 * 
9 * Input: accounts = [[1,2,3],[3,2,1]]
10 * Output: 6
11 * Explanation:
12 * 1st customer has wealth = 1 + 2 + 3 = 6
13 * 2nd customer has wealth = 3 + 2 + 1 = 6
14 * Both customers are considered the richest with a wealth of 6 each, so return 6.
15 * 
16 * Example 2:
17 * 
18 * Input: accounts = [[1,5],[7,3],[3,5]]
19 * Output: 10
20 * Explanation: 
21 * 1st customer has wealth = 6
22 * 2nd customer has wealth = 10 
23 * 3rd customer has wealth = 8
24 * The 2nd customer is the richest with a wealth of 10.
25 * Example 3:
26 * 
27 * Input: accounts = [[2,8,7],[7,1,3],[1,9,5]]
28 * Output: 17
29 * 
30 *  
31 * Constraints:
32 * 
33 * 	m == accounts.length
34 * 	n == accounts[i].length
35 * 	1 <= m, n <= 50
36 * 	1 <= accounts[i][j] <= 100
37 * 
38 */
39pub struct Solution {}
40
41// problem: https://leetcode.com/problems/richest-customer-wealth/
42// discuss: https://leetcode.com/problems/richest-customer-wealth/discuss/?currentPage=1&orderBy=most_votes&query=
43
44// submission codes start here
45
46impl Solution {
47    pub fn maximum_wealth(accounts: Vec<Vec<i32>>) -> i32 {
48        0
49    }
50}
51
52// submission codes end
53
54#[cfg(test)]
55mod tests {
56    use super::*;
57
58    #[test]
59    fn test_1672() {
60    }
61}
62


Back
© 2025 bowen.ge All Rights Reserved.