当前位置:网站首页>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 tutorial
- Use canal and rocketmq to listen to MySQL binlog logs
- Deleting nodes in binary search tree
- 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
- Scala基础教程--20--Akka
- [release] a tool for testing WebService and database connection - dbtest v1.0
- 千万不要只学 Oracle、MySQL!
- Learning path PHP -- phpstudy "hosts file does not exist or is blocked from opening" when creating the project
- prometheus安装
- 神经网络物联网是什么意思通俗的解释
猜你喜欢
How is the entered query SQL statement executed?
Wireshark packet capturing TLS protocol bar displays version inconsistency
How to modify icons in VBS or VBE
Nebula importer data import practice
从实时应用角度谈通信总线仲裁机制和网络流控
整理混乱的头文件,我用include what you use
Scala basic tutorial -- 19 -- actor
Li Kou brush question diary /day1/2022.6.23
Improve the accuracy of 3D reconstruction of complex scenes | segmentation of UAV Remote Sensing Images Based on paddleseg
2022CoCa: Contrastive Captioners are Image-Text Fountion Models
随机推荐
Pb extended DLL development (super chapter) (VII)
Microservice architecture debate between radical technologists vs Project conservatives
Scala basic tutorial -- 13 -- advanced function
Li Chi's work and life summary in June 2022
Other InterSystems%net tools
Wanghongru research group of Institute of genomics, Chinese Academy of Agricultural Sciences is cordially invited to join
The latest progress of Intel Integrated Optoelectronics Research promotes the progress of CO packaging optics and optical interconnection technology
一种将Tree-LSTM的强化学习用于连接顺序选择的方法
Technology sharing | interface testing value and system
请教一下 flinksql中 除了数据统计结果是状态被保存 数据本身也是状态吗
Nature microbiology | viral genomes in six deep-sea sediments that can infect Archaea asgardii
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
[cloud voice suggestion collection] cloud store renewal and upgrading: provide effective suggestions, win a large number of code beans, Huawei AI speaker 2!
删除字符串中出现次数最少的字符【JS,Map排序,正则】
数组中的第K个最大元素
[opencv introduction to mastery 9] opencv video capture, image and video conversion
启牛开的证券账户安全吗?
Basic tutorial of scala -- 16 -- generics
Download the first Tencent technology open day course essence!
A method of using tree LSTM reinforcement learning for connection sequence selection