반응형
오늘 풀 문제는 Richest Customer Wealth라는 문제이며
링크는 leetcode.com/contest/weekly-contest-217/problems/richest-customer-wealth/입니다
이 문제는 각 배열안의 합에서 최대의 합을 구하는 문제로 이중 포문으로 풀었습니다
코드는 아래와 같습니다
func maximumWealth(accounts [][]int) int {
result := 0;
for _, val := range accounts{
temp_sum := 0;
for _, nested_val := range val{
temp_sum += nested_val;
}
if(result <= temp_sum){
result = temp_sum;
}
}
return result;
}
'Language > Go' 카테고리의 다른 글
[Golang으로 도전하는 Leetcode] Goal Parser Interpretation (0) | 2020.12.09 |
---|---|
[Golang으로 도전하는 Leetcode] Goal Parser Interpretation (0) | 2020.12.09 |
[Golang으로 도전하는 Leetcode] Smallest String With A Given Numeric Value (0) | 2020.12.02 |
[Golang으로 도전하는 Leetcode] Ways to Make a Fair Array (0) | 2020.11.30 |
[Golang으로 도전하는 Leetcode] Check If Two String Arrays are Equivalent (0) | 2020.11.30 |