알고리즘
[알고리즘] Richest Customer Wealth
keel_im
2021. 1. 19. 14:34
반응형
포인트
1. 파이썬은 정말 간단하다. 이걸 만든 사람들은 대체 어떤 것을 한 것일까? 궁금하다
🧶문서는 항상 수정 될 수 있습니다. 비판은 환영합니다.
class Solution {
public:
int maximumWealth(vector<vector<int>>& accounts) {
int rich = 0;
for(auto person : accounts){
int a = 0;
for(auto money : person) a+=money;
rich = max(rich, a);
}
return rich;
}
};
c++
class Solution:
def maximumWealth(self, accounts: List[List[int]]) -> int:
return max([ sum(i) for i in accounts])
python
어떻게 한 줄로 저 기다란 코드를 줄일 수 있었던 걸까?
반응형