Skip to main content

Command Palette

Search for a command to run...

Richest Customer Wealth

Published
1 min read
Richest Customer Wealth
G

As a Systems Engineer at Tata Consultancy Services, I deliver exceptional software products for mobile and web platforms, using agile methodologies and robust quality maintenance. I am experienced in performance testing, automation testing, API testing, and manual testing, with various tools and technologies such as Jmeter, Azure LoadTest, Selenium, Java, OOPS, Maven, TestNG, and Postman.

I have successfully developed and executed detailed test plans, test cases, and scripts for Android and web applications, ensuring high-quality standards and user satisfaction. I have also demonstrated my proficiency in manual REST API testing with Postman, as well as in end-to-end performance and automation testing using Jmeter and selenium with Java, TestNG and Maven. Additionally, I have utilized Azure DevOps for bug tracking and issue management.

You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the i​​​​​<sup>​​​​​​th</sup>​​​​ customer has in the j​​​​​<sup>​​​​​​th</sup>​​​​ bank. Return the wealth that the richest customer has.

A customer's wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth.

LeetCode Problem - 1672

class Solution {
    public int maximumWealth(int[][] accounts) {
        // Initialize a variable 'maxVal' to keep track of the maximum wealth found.
        int maxVal = 0;
        // Iterate through each 'account' in the 'accounts' array.
        for (int[] account : accounts) {
            // Initialize a temporary variable 'temp' to store the sum of wealth for the current customer.
            int temp = 0;
            // Iterate through each element 'j' in the 'account'.
            for (int j = 0; j < accounts[0].length; j++) {
                // Add the wealth at index 'j' to the 'temp' variable.
                temp += account[j];
            }
            // Check if the wealth of the current customer ('temp') is greater than the current maximum wealth ('maxVal').
            // If so, update 'maxVal' to the wealth of the current customer.
            if (temp > maxVal) {
                maxVal = temp;
            }
        }
        // Return the maximum wealth among all the customers.
        return maxVal;
    }
}

More from this blog

S

Software and Performance Testing Insights

462 posts

Results-Driven Agile QA Specialist | Expert in Mobile & Web Testing | Proficient in Test Planning, Execution, and Root Cause Analysis.