Skip to content

Commit 868d57d

Browse files
committed
✨ [1672] Richest Customer Wealth
1 parent 4ff70e5 commit 868d57d

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

Diff for: 1672/my_solution.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 = (accounts) => {
6+
let max = 0;
7+
8+
for (let r = 0; r < accounts.length; r++) {
9+
let tmpMax = 0;
10+
for (let c = 0; c < accounts[r].length; c++) {
11+
tmpMax += accounts[r][c];
12+
}
13+
max = Math.max(max, tmpMax);
14+
}
15+
return max;
16+
};

Diff for: 1672/solution.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 = (accounts) => {
6+
let max = 0;
7+
8+
for (let r = 0; r < accounts.length; r++) {
9+
let tmpMax = 0;
10+
for (let c = 0; c < accounts[r].length; c++) {
11+
tmpMax += accounts[r][c];
12+
}
13+
max = Math.max(max, tmpMax);
14+
}
15+
return max;
16+
};

Diff for: README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
- [1365. How Many Numbers Are Smaller Than the Current Number](./1365/)
7575
- [1512. Number of Good Pairs](./1512/)
7676
- [1569. Number of Ways to Reorder Array to Get Same BST](./1569/)
77+
- [1672. Richest Customer Wealth](./1672/)
7778
- [1791. Find Center of Star Graph](./1791/)
7879
- [1909. Remove One Element to Make the Array Strictly Increasing](./1909/)
7980
- [1971. Find if Path Exists in Graph](./1971/)
@@ -121,7 +122,7 @@ Batch create:
121122
NOTE: JS IS HERE
122123
-->
123124
```ssh
124-
chapter=79 && mkdir ./$chapter && touch ./$chapter/my_solution.js && touch ./$chapter/solution.js && alias x="node ./$chapter/my_solution.js"
125+
chapter=1672 && mkdir ./$chapter && touch ./$chapter/my_solution.js && touch ./$chapter/solution.js && alias x="node ./$chapter/my_solution.js"
125126
```
126127
> then you can use `x` for quick debug.
127128

0 commit comments

Comments
 (0)