当前位置:网站首页>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;
}
}
边栏推荐
- 1、 Introduction to C language
- Download the first Tencent technology open day course essence!
- Process of manually encrypt the mass-producing firmware and programming ESP devices
- How to download files using WGet and curl
- 一、C语言入门基础
- 神经网络物联网是什么意思通俗的解释
- Scala basic tutorial -- 13 -- advanced function
- Deleting nodes in binary search tree
- 使用FTP
- 【2022年江西省研究生数学建模】冰壶运动 思路分析及代码实现
猜你喜欢
正则替换【JS,正则表达式】
[go ~ 0 to 1] read, write and create files on the sixth day
Scala basic tutorial -- 15 -- recursion
物联网应用技术的就业前景和现状
Angry bird design based on unity
神经网络物联网应用技术就业前景【欢迎补充】
Li Kou brush question diary /day7/2022.6.29
Basic tutorial of scala -- 16 -- generics
Lex and yacc based lexical analyzer + parser
Scala基础教程--16--泛型
随机推荐
[go ~ 0 to 1] read, write and create files on the sixth day
每日一题(2022-07-02)——最低加油次数
[2022 Jiangxi graduate mathematical modeling] curling movement idea analysis and code implementation
Li Kou brush question diary /day8/7.1
Build your own website (15)
6.26CF模拟赛B:数组缩减题解
物联网应用技术的就业前景和现状
6.26cf simulation match B: solution to array reduction problem
神经网络物联网平台搭建(物联网平台搭建实战教程)
基于lex和yacc的词法分析器+语法分析器
Digital "new" operation and maintenance of energy industry
[cloud voice suggestion collection] cloud store renewal and upgrading: provide effective suggestions, win a large number of code beans, Huawei AI speaker 2!
英特尔集成光电研究最新进展推动共封装光学和光互连技术进步
Scala基础教程--16--泛型
Li Chi's work and life summary in June 2022
Scala基础教程--12--读写数据
MXNet对GoogLeNet的实现(并行连结网络)
NBA赛事直播超清画质背后:阿里云视频云「窄带高清2.0」技术深度解读
工厂从自动化到数字孪生,图扑能干什么?
DeFi生态NFT流动性挖矿系统开发搭建