본문 바로가기

IT/코딩테스트

[Leetcode] 1672. Richest Customer Wealth

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