Skip to content

Instantly share code, notes, and snippets.

@kingsamadesu
Created December 3, 2020 21:12
Show Gist options
  • Save kingsamadesu/4fe456ced5aac368d2fcb1a0b309a065 to your computer and use it in GitHub Desktop.
Save kingsamadesu/4fe456ced5aac368d2fcb1a0b309a065 to your computer and use it in GitHub Desktop.
1672. Richest Customer Wealth -with java- (leetcode.com).
/*
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