Skip to content

Commit 7093a36

Browse files
committed
Add solution #1672
1 parent e0ee629 commit 7093a36

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@
206206
1566|[Detect Pattern of Length M Repeated K or More Times](./1566-detect-pattern-of-length-m-repeated-k-or-more-times.js)|Easy|
207207
1598|[Crawler Log Folder](./1598-crawler-log-folder.js)|Easy|
208208
1668|[Maximum Repeating Substring](./1668-maximum-repeating-substring.js)|Easy|
209+
1672|[Richest Customer Wealth](./1672-richest-customer-wealth.js)|Easy|
209210
1780|[Check if Number is a Sum of Powers of Three](./1780-check-if-number-is-a-sum-of-powers-of-three.js)|Medium|
210211
1880|[Check if Word Equals Summation of Two Words](./1880-check-if-word-equals-summation-of-two-words.js)|Easy|
211212
1929|[Concatenation of Array](./1929-concatenation-of-array.js)|Easy|
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* 1672. Richest Customer Wealth
3+
* https://leetcode.com/problems/richest-customer-wealth/
4+
* Difficulty: Easy
5+
*
6+
* You are given an m x n integer grid accounts where accounts[i][j] is the
7+
* amount of money the i​​​​​​​​​​​th​​​​ customer has in the j​​​​​​​​​​​th​​​​ bank. Return the wealth
8+
* that the richest customer has.
9+
*
10+
* A customer's wealth is the amount of money they have in all their bank
11+
* accounts. The richest customer is the customer that has the maximum wealth.
12+
*/
13+
14+
/**
15+
* @param {number[][]} accounts
16+
* @return {number}
17+
*/
18+
var maximumWealth = function(accounts) {
19+
return Math.max(...accounts.map(account => account.reduce((sum, n) => sum + n), 0));
20+
};

0 commit comments

Comments
 (0)