Skip to content

Commit 008d5d5

Browse files
author
Ayushi
committed
Richest Customer Wealth
1 parent f1eb53f commit 008d5d5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

richest-wealth.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Question Link : https://leetcode.com/problems/richest-customer-wealth/
2+
3+
class Solution {
4+
public:
5+
int maximumWealth(vector<vector<int>>& accounts) {
6+
int val = INT_MIN;
7+
int sum ;
8+
int row = accounts.size(); //row
9+
int col = accounts[0].size(); //col
10+
for(int i=0;i<row;i++)
11+
{
12+
sum = 0;
13+
for(int j=0;j<col;j++)
14+
{
15+
sum += accounts[i][j];
16+
}
17+
val = max(val,sum);
18+
}
19+
return val;
20+
21+
}
22+
};

0 commit comments

Comments
 (0)