---
# System prepended metadata

title: 1672. Richest Customer Wealth

---

# 1672. Richest Customer Wealth

## [題目:](https://leetcode.com/problems/number-of-good-pairs/)

給定一個二維陣列，找出相加為最大陣列並算出值來  
這些值分別代表著客戶及他們每一家的銀行存款，並從中找出最有錢的人擁有的資金  
ex:`[[1,2,3],[3,2,1]]`
1+2+3 vs 3+2+1 都是6，所以輸出為`6`


## 思路

一個個累加帳號所有銀行內的錢，挑出最大值  

```go=
func maximumWealth(accounts [][]int) int {
	var maxWealth = 0
	for _, account := range accounts {
		var wealth = 0
		for _, bank := range account {
			wealth += bank
		}
		if maxWealth < wealth {
			maxWealth = wealth
		}
	}
	return maxWealth
}

```