当前位置:网站首页>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;
}
}
边栏推荐
猜你喜欢
TorchDrug教程
使用canal配合rocketmq监听mysql的binlog日志
Rookie post station management system based on C language
【2022年江西省研究生数学建模】冰壶运动 思路分析及代码实现
DeFi生态NFT流动性挖矿系统开发搭建
Improve the accuracy of 3D reconstruction of complex scenes | segmentation of UAV Remote Sensing Images Based on paddleseg
神经网络物联网平台搭建(物联网平台搭建实战教程)
性能优化之关键渲染路径
神经网络物联网应用技术学什么
Li Kou brush question diary /day4/6.26
随机推荐
Scala基础教程--13--函数进阶
Halcon template matching
The latest progress of Intel Integrated Optoelectronics Research promotes the progress of CO packaging optics and optical interconnection technology
利用策略模式优化if代码【策略模式】
Improve the accuracy of 3D reconstruction of complex scenes | segmentation of UAV Remote Sensing Images Based on paddleseg
Pb extended DLL development (super chapter) (VII)
Principle and application of ThreadLocal
[go ~ 0 to 1] read, write and create files on the sixth day
Cache é JSON uses JSON adapters
2022-07-04: what is the output of the following go language code? A:true; B:false; C: Compilation error. package main import 'fmt' func
性能优化之关键渲染路径
2022养生展,健康展,北京大健康展,健康产业展11月举办
物联网应用技术的就业前景和现状
IBM WebSphere MQ检索邮件
C language printing exercise
Basic tutorial of scala -- 16 -- generics
IBM WebSphere MQ retrieving messages
Scala basic tutorial -- 17 -- Collection
奥迪AUDI EDI INVOIC发票报文详解
Angry bird design based on unity