1672. Richest Customer Wealth leetcode solution in c++

#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
    int maximumWealth(vector<vector<int>>& accounts) {
        int maxWealth = 0;
        for (const auto& customer : accounts) {
            int currentWealth = 0;
            for (int accountBalance : customer) {
                currentWealth += accountBalance;
            }
            maxWealth = max(maxWealth, currentWealth);
        }
        return maxWealth;
    }
};

int main() {
    // Example usage
    Solution solution;
    vector<vector<int>> accounts = {{1, 2, 3}, {3, 2, 1}, {4, 5, 6}};
    int result = solution.maximumWealth(accounts);
    cout << "Maximum Wealth: " << result << endl;

    return 0;
}