Skip to content

Commit 39cbdd2

Browse files
authored
Create 1672-richest-customer-wealth.js
1 parent ccadd91 commit 39cbdd2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

1672-richest-customer-wealth.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* @param {number[][]} accounts
3+
* @return {number}
4+
*/
5+
const maximumWealth = function(accounts) {
6+
let max = -Infinity
7+
const m = accounts.length, n = accounts[0].length
8+
for(let i = 0; i < m; i++) {
9+
let tmp = 0
10+
for(let j = 0; j < n; j++) {
11+
tmp += accounts[i][j]
12+
}
13+
max = Math.max(max, tmp)
14+
}
15+
return max
16+
};

0 commit comments

Comments
 (0)