当前位置:网站首页>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;
}
}
边栏推荐
- Perfect JS event delegation
- Technology sharing | interface testing value and system
- [cloud voice suggestion collection] cloud store renewal and upgrading: provide effective suggestions, win a large number of code beans, Huawei AI speaker 2!
- Using FTP
- [mathematical basis of machine learning] (I) linear algebra (Part 1 +)
- php伪原创api对接方法
- 自由小兵儿
- Download the first Tencent technology open day course essence!
- 模板_大整数减法_无论大小关系
- C语言打印练习
猜你喜欢

Scala基础教程--16--泛型

2022CoCa: Contrastive Captioners are Image-Text Fountion Models

Scala基础教程--20--Akka

Wireshark packet capturing TLS protocol bar displays version inconsistency

字节跳动Dev Better技术沙龙成功举办,携手华泰分享Web研发效能提升经验

Microservice architecture debate between radical technologists vs Project conservatives

性能优化之关键渲染路径

Mxnet implementation of googlenet (parallel connection network)

My colleagues quietly told me that flying Book notification can still play like this

Learning path PHP -- phpstudy "hosts file does not exist or is blocked from opening" when creating the project
随机推荐
自由小兵儿
奥迪AUDI EDI INVOIC发票报文详解
Is Guoyuan futures a regular platform? Is it safe to open an account in Guoyuan futures?
Using SSH
Angry bird design based on unity
Li Chi's work and life summary in June 2022
Li Kou brush question diary /day1/2022.6.23
Scala basic tutorial -- 20 -- akka
激进技术派 vs 项目保守派的微服务架构之争
MXNet对GoogLeNet的实现(并行连结网络)
Installation and use of VMware Tools and open VM tools: solve the problems of incomplete screen and unable to transfer files of virtual machines
Scala基础教程--16--泛型
小发猫物联网平台搭建与应用模型
C语言打印练习
Scala基础教程--12--读写数据
prometheus安装
Cache é JSON uses JSON adapters
资料下载 丨首届腾讯技术开放日课程精华!
1、 Introduction to C language
ByteDance dev better technology salon was successfully held, and we joined hands with Huatai to share our experience in improving the efficiency of web research and development