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.
Input: accounts = [[1,2,3],[3,2,1]] Output: 6 Explanation: 1st customer has wealth = 1 + 2 + 3 = 6 2nd customer has wealth = 3 + 2 + 1 = 6 Both customers are considered the richest with a wealth of 6 each, so return 6.
Input: accounts = [[1,5],[7,3],[3,5]] Output: 10 Explanation: 1st customer has wealth = 6 2nd customer has wealth = 10 3rd customer has wealth = 8 The 2nd customer is the richest with a wealth of 10.
Input: accounts = [[2,8,7],[7,1,3],[1,9,5]] Output: 17
m == accounts.length n == accounts[i].length 1 <= m, n <= 50 1 <= accounts[i][j] <= 100
The sum of the numbers in each row in the table Accounts is the total amount of the user’s deposits.
class Solution(object): def maximumWealth(self, accounts): """ :type accounts: List[List[int]] :rtype: int """ mx = -1 for account in accounts: mx = max(mx, sum(account)) return mx # be simple class Solution(object): def maximumWealth(self, accounts): """ :type accounts: List[List[int]] :rtype: int """ return max(map(sum, accounts))
Runtime: 32 ms, faster than 95.52% of Python online submissions for Richest Customer Wealth. Memory Usage: 13.6 MB, less than 8.15% of Python online submissions for Richest Customer Wealth.
- Python: LeetCode 43 Multiply Strings
- Invalid python sd, Fatal Python error: init_fs_encoding: failed to get the Python cod [How to Solve]
- [Solved] NPM install Error: check python checking for Python executable python2 in the PATH
- How to Solve Python WARNING: Ignoring invalid distribution -ip (e:\python\python_dowmload\lib\site-packages)
- [Solved] opencv-python: recipe for target ‘modules/python3/CMakeFiles/opencv_python3.dir/all‘ failed
- Python Error: pip install mysql-connector-python failed
- Linux installs Python and upgrades Python
- Opencv-python Install is Stuck Error: running setup.py bdist_wheel for opencv-python
- [Solved] supervisor Error: /usr/local/lib/python2.7/dist-packages/pkg_resources/py2_warn.py:22: UserWarning: Setuptools will stop working on Python 2
- npm install Error: stack Error: Can’t find Python executable “python”
- [Solved] Python Error: tensorflow.python.framework.errors_impl.UnknownError: 2 root error(s) found.
- [leetcode] 295. Find Median from Data Stream Python
- Pychar can’t connect to Python console, but it can run. Py file, and Anaconda’s command line can run Python command
- [Solved] cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\……
- Python: ___ () vs ___ str__()
- Python uses try… Except… To output detailed errors
- How to Fix keyerror in Python dictionary lookup
- Python exports the gitlab project
- Python classes that connect to the database
- Full explanation of SYS module of Python