Problem solving/Algorithms

[LeetCode] 1672. Richest Customer Wealth (Python)

Young_A 2021. 1. 9. 14:23

LeetCode - Problems - Algorithms - 1672. Richest Customer Wealth

Problem Description

You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the ith customer has in the jth bank.

Return the wealth that the richest customer has.

 

A customer's wealth is the amount of money they have in all their bank accounts.

The richest customer is the customer that has the maximum wealth.

 

Example:

Constraints:

My Solution (Python)

class Solution:
    def maximumWealth(self, accounts):
        accounts = [sum(wealth) for wealth in accounts]
        return max(accounts)