소프트웨어에 대한 모든 것

LeetCode 풀이 - 1672. Richest Customer Wealth 본문

알고리즘/LeetCode

LeetCode 풀이 - 1672. Richest Customer Wealth

앤테바 2021. 10. 16. 16:13
반응형

Richest Customer Wealth

문제)

 

솔루션1)

class Solution:
    def maximumWealth(self, accounts: List[List[int]]) -> int:
        max_wealth = 0
        for account in accounts:            
            max_wealth = max(max_wealth, sum(account))                
        return max_wealth

솔루션2)

class Solution:
    def maximumWealth(self, accounts: List[List[int]]) -> int:
        return max(map(sum, accounts))

 

반응형
Comments