728x90
https://leetcode.com/problems/richest-customer-wealth/
int maximumWealth(int** accounts, int accountsSize, int* accountsColSize){
int max = 0;
for (int i = 0; i < accountsSize; i++) {
int sum = 0;
for (int j = 0; j < *(accountsColSize + i); j++) {
sum += *(*(accounts + i) + j);
}
if (sum > max) {
max = sum;
}
}
return max;
}
728x90
'IT > 코딩테스트' 카테고리의 다른 글
[Leetcode] 383. Ransom Note (0) | 2023.08.11 |
---|---|
[Leetcode] 511. Game Play Analysis I (0) | 2023.08.10 |
[Leetcode] 1342. Number of Steps to Reduce a Number to Zero (0) | 2023.08.09 |
[Leetcode] 412. Fizz Buzz (0) | 2023.08.09 |
[Leetcode] 1480. Running Sum of 1d Array (0) | 2023.08.07 |