Skip to content

Commit 52b74b8

Browse files
solves richest customer wealth
1 parent 431d9de commit 52b74b8

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@
412412
| 1656 | [Design an Ordered Stream](https://leetcode.com/problems/design-an-ordered-stream) | [![Java](assets/java.png)](src/DesignAnOrderedStream.java) | |
413413
| 1662 | [Check If Two String Arrays are Equivalent](https://leetcode.com/problems/check-if-two-string-arrays-are-equivalent) | [![Java](assets/java.png)](src/CheckIfTwoStringArraysAreEquivalent.java) | |
414414
| 1668 | [Maximum Repeating Substring](https://leetcode.com/problems/maximum-repeating-substring) | [![Java](assets/java.png)](src/MaximumRepeatingSubString.java) | |
415-
| 1672 | [Richest Customer Wealth](https://leetcode.com/problems/richest-customer-wealth) | | |
415+
| 1672 | [Richest Customer Wealth](https://leetcode.com/problems/richest-customer-wealth) | [![Java](assets/java.png)](src/RichestCustomerWealth.java) | |
416416
| 1678 | [Goal Parser Interpretation](https://leetcode.com/problems/goal-parser-interpretation) | | |
417417
| 1684 | [Count the Number of Consistent Strings](https://leetcode.com/problems/count-the-number-of-consistent-strings) | | |
418418
| 1688 | [Count of Matches in Tournament](https://leetcode.com/problems/count-of-matches-in-tournament) | | |

src/RichestCustomerWealth.java

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import java.util.Arrays;
2+
3+
public class RichestCustomerWealth {
4+
public int maximumWealth(int[][] accounts) {
5+
int maxWealth = 0;
6+
for (int[] customer : accounts) {
7+
maxWealth = Math.max(maxWealth, Arrays.stream(customer).sum());
8+
}
9+
return maxWealth;
10+
}
11+
}

0 commit comments

Comments
 (0)