Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Richest Customer Wealth

class Solution {
    public int maximumWealth(int[][] accounts) {
        int max = 0;
        for (int[] account : accounts) {
            int sum = 0;
            for (int i : account) {
                sum += i;
                if (sum > max) max = sum;
            }
        }
        return max;
    }
}
 
PREVIOUS NEXT
Tagged: #Richest #Customer #Wealth
ADD COMMENT
Topic
Name
1+2 =