The title

Give you an integer grid of m x n accounts, where accounts[I][j] is the number of assets held in custody by the ith customer at the JTH bank. Returns the total amount of assets owned by the richest clients.

The client’s total assets are the sum of the assets they hold in custody at various banks. The richest clients are those with the largest total assets.

 

Example 1: input: accounts = [[1,2,3],[3,2,1]] output: 6 The total assets of the first customer = 1 + 2 + 3 = 6 The total assets of the second customer = 3 + 2 + 1 = 6 both customers are the richest, they both have 6 assets, so return 6. Example 2: input: accounts = [[1,5],[7,3],[3,5]] output: 10 Total assets of the first customer = 6 Total assets of the second customer = 10 Total assets of the third customer = 8 The second customer is the richest and the total assets are 10. Example 3: Input: Accounts = [[2,8,7],[7,1,3],[1,9,5] output: 17Copy the code

Tip:

m == accounts.length n == accounts[i].length 1 <= m, n <= 50 1 <= accounts[i][j] <= 100

Their thinking

class Solution: def maximumWealth(self, accounts: List[List[int]]) -> int: # res = 0 # for arr in accounts: # max = sum(arr) # if max > res: Return Max (sum(I) for I in accounts) return Max (sum(accounts[I]) for I in range(len(accounts))) if __name__ == '__main__': Accounts = [[2,8,7],[7,1,3],[1,9,5]] ret = Solution().maximumwealth (accounts) print(ret)Copy the code