Created
December 3, 2020 21:12
-
-
Save kingsamadesu/4fe456ced5aac368d2fcb1a0b309a065 to your computer and use it in GitHub Desktop.
1672. Richest Customer Wealth -with java- (leetcode.com).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Your runtime beats 100.00 % of java submissions. | |
Your memory usage beats 47.74 % of java submissions. | |
*/ | |
class Solution { | |
public int maximumWealth(int[][] accounts) { | |
int max = 0; | |
int sum = 0; | |
for (int i = 0 ; i < accounts.length ; i++){ | |
for (int j = 0 ; j < accounts[0].length ; j++){ | |
sum += accounts[i][j]; | |
} | |
if (sum > max)max = sum; | |
sum = 0; | |
} | |
return max; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment