난이도: Easy
You are given an
m
xn
integer gridaccounts
whereaccounts[i][j]
is the amount of money thei
th customer has in thej
th bank. Return the wealth that the richest customer has.
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.
/**
* @param {number[][]} accounts
* @return {number}
*/
var maximumWealth = function(accounts) {
let row = accounts.length;
let col = accounts[0].length;
let max = 0;
for(let i = 0; i < row; i++){
let temp = 0;
for(let j = 0; j < col; j++){
temp += accounts[i][j];
if(max < temp) max = temp;
}
}
return max;
};