当前位置:网站首页>1672. Total assets of the richest customers
1672. Total assets of the richest customers
2022-07-04 19:20:00 【charlsdm】
- Total assets of the richest clients
To give you one m x n The integer grid of accounts , among accounts[i][j] It's No i Customers are at number j The number of assets held by banks . Return to what the richest customer has Total assets .
Customer's Total assets It's the sum of the number of assets they hold in each bank . The richest customer is Total assets The biggest customers .
Example 1:
Input :accounts = [[1,2,3],[3,2,1]]
Output :6
explain :
The first 1 Total assets of customers = 1 + 2 + 3 = 6
The first 2 Total assets of customers = 3 + 2 + 1 = 6
Both clients are the richest , The total amount of assets is 6 , So back 6 .
Example 2:
Input :accounts = [[1,5],[7,3],[3,5]]
Output :10
explain :
The first 1 Total assets of customers = 6
The first 2 Total assets of customers = 10
The first 3 Total assets of customers = 8
The first 2 Customers are the richest , The total assets are 10
Example 3:
Input :accounts = [[2,8,7],[7,1,3],[1,9,5]]
Output :17
My code is attached below
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;
}
}
边栏推荐
- Li Kou brush question diary /day4/6.26
- How is the entered query SQL statement executed?
- Nebula Importer 数据导入实践
- 大佬们,求助一下,我用mysql cdc 2.2.1(flink 1.14.5)写入kafka,设置
- Halcon template matching
- Scala basic tutorial -- 18 -- set (2)
- Scala基础教程--18--集合(二)
- Mxnet implementation of googlenet (parallel connection network)
- 【2022年江西省研究生数学建模】冰壶运动 思路分析及代码实现
- Other InterSystems%net tools
猜你喜欢
Li Kou brush question diary /day2/2022.6.24
Behind the ultra clear image quality of NBA Live Broadcast: an in-depth interpretation of Alibaba cloud video cloud "narrowband HD 2.0" technology
每日一题(2022-07-02)——最低加油次数
基于lex和yacc的词法分析器+语法分析器
Wireshark网络抓包
2022年字节跳动日常实习面经(抖音)
A method of using tree LSTM reinforcement learning for connection sequence selection
[uniapp] uniapp development app online Preview PDF file
Scala基础教程--13--函数进阶
Scala基础教程--20--Akka
随机推荐
Wireshark抓包TLS协议栏显示版本不一致问题
Scala基础教程--20--Akka
Installation and use of VMware Tools and open VM tools: solve the problems of incomplete screen and unable to transfer files of virtual machines
Caché WebSocket
Is the securities account opened by qiniu safe?
How to open an account is safe,
【机器学习的数学基础】(一)线性代数(Linear Algebra)(上+)
信息学奥赛一本通 1336:【例3-1】找树根和孩子
Wanghongru research group of Institute of genomics, Chinese Academy of Agricultural Sciences is cordially invited to join
更安全、更智能、更精致,长安Lumin完虐宏光MINI EV?
2022CoCa: Contrastive Captioners are Image-Text Fountion Models
学习路之PHP--phpstudy创建项目时“hosts文件不存在或被阻止打开”
技术分享 | 接口测试价值与体系
【OpenCV入门到精通之九】OpenCV之视频截取、图片与视频互转
读写关闭的channel是啥后果?
Go微服务(二)——Protobuf详细入门
Scala基础教程--13--函数进阶
神经网络物联网应用技术就业前景【欢迎补充】
C language printing exercise
Li Kou brush question diary /day3/2022.6.25