当前位置:网站首页>1672. 最富有客户的资产总量
1672. 最富有客户的资产总量
2022-07-04 17:39:00 【charlsdm】
- 最富有客户的资产总量
给你一个 m x n 的整数网格 accounts ,其中 accounts[i][j] 是第 i 位客户在第 j 家银行托管的资产数量。返回最富有客户所拥有的 资产总量 。
客户的 资产总量 就是他们在各家银行托管的资产数量之和。最富有客户就是 资产总量 最大的客户。
示例 1:
输入:accounts = [[1,2,3],[3,2,1]]
输出:6
解释:
第 1 位客户的资产总量 = 1 + 2 + 3 = 6
第 2 位客户的资产总量 = 3 + 2 + 1 = 6
两位客户都是最富有的,资产总量都是 6 ,所以返回 6 。
示例 2:
输入:accounts = [[1,5],[7,3],[3,5]]
输出:10
解释:
第 1 位客户的资产总量 = 6
第 2 位客户的资产总量 = 10
第 3 位客户的资产总量 = 8
第 2 位客户是最富有的,资产总量是 10
示例 3:
输入:accounts = [[2,8,7],[7,1,3],[1,9,5]]
输出:17
下边附上我的代码
public class Solution {
public int MaximumWealth(int[][] accounts) {
int min = -1;
int row = accounts.GetLength(0);
int[] sum = new int[row];
for(int i=0;i<row;i++)
{
for(int j=0;j<accounts[i].Length;j++)
{
sum[i] += accounts[i][j];
}
}
for(int i=0;i<row;i++)
{
if(sum[i]>min)
{
min = sum[i];
}
}
return min;
}
}
边栏推荐
- Build your own website (15)
- 一种将Tree-LSTM的强化学习用于连接顺序选择的方法
- 大佬们,求助一下,我用mysql cdc 2.2.1(flink 1.14.5)写入kafka,设置
- How is the entered query SQL statement executed?
- 6.26cf simulation race e: solution to the problem of price maximization
- 正则替换【JS,正则表达式】
- 力扣刷题日记/day7/2022.6.29
- [发布] 一个测试 WebService 和数据库连接的工具 - DBTest v1.0
- 工厂从自动化到数字孪生,图扑能干什么?
- Is Guoyuan futures a regular platform? Is it safe to open an account in Guoyuan futures?
猜你喜欢

2022 ByteDance daily practice experience (Tiktok)

Halcon模板匹配

Li Kou brush question diary /day4/6.26

How is the entered query SQL statement executed?

Digital "new" operation and maintenance of energy industry

神经网络物联网是什么意思通俗的解释

Li Kou brush question diary /day8/7.1

Angry bird design based on unity

力扣刷题日记/day5/2022.6.27

奥迪AUDI EDI INVOIC发票报文详解
随机推荐
性能优化之关键渲染路径
vbs或vbe如何修改图标
VMware Tools和open-vm-tools的安装与使用:解决虚拟机不全屏和无法传输文件的问题
Interpretation of SIGMOD '22 hiengine paper
[发布] 一个测试 WebService 和数据库连接的工具 - DBTest v1.0
[go language question brushing chapter] go conclusion chapter | introduction to functions, structures, interfaces, and errors
力扣刷題日記/day6/6.28
How to modify icons in VBS or VBE
Scala基础教程--20--Akka
输入的查询SQL语句,是如何执行的?
From automation to digital twins, what can Tupo do?
Scala basic tutorial -- 15 -- recursion
删除字符串中出现次数最少的字符【JS,Map排序,正则】
国元期货是正规平台吗?在国元期货开户安全吗?
2022养生展,健康展,北京大健康展,健康产业展11月举办
Scala basic tutorial -- 14 -- implicit conversion
【2022年江西省研究生数学建模】水汽过饱和的核化除霾 思路分析及代码实现
IBM WebSphere MQ检索邮件
[mathematical basis of machine learning] (I) linear algebra (Part 1 +)
Digital "new" operation and maintenance of energy industry