You are given an m×n integer grid accounts where accounts[i][j] is the amount the i-th customer has in the j-th bank. Return the wealth of the richest customer (max row sum).
accounts = [[1,2,3],[3,2,1]]6maxWealth = 0rowSummaxWealth = max(maxWealth, rowSum)maxWealthA customer's wealth = sum of all their bank accounts (one matrix row). We simply compute each row sum and track the maximum — no sorting or extra space needed. One nested loop covers all m×n cells.