1672. Richest Customer Wealth ¶ Time: $O(mn)$ Space: $O(1)$ C++JavaPython 1 2 3 4 5 6 7 8 9class Solution { public: int maximumWealth(vector<vector<int>>& accounts) { return accumulate(accounts.begin(), accounts.end(), 0, [](int subtotal, const vector<int>& account) { return max(subtotal, accumulate(account.begin(), account.end(), 0)); }); } }; 1 2 3 4 5 6 7 8class Solution { public int maximumWealth(int[][] accounts) { return Arrays.stream(accounts) .mapToInt(account -> Arrays.stream(account).sum()) .max() .getAsInt(); } } 1 2 3class Solution: def maximumWealth(self, accounts: list[list[int]]) -> int: return max(map(sum, accounts))