Maximum Reward (Intuit India)
MS Dhoni is known for his cool nature, however, on many occasions we have seen him lose his calmness when his fielders drop catches. Catches win matches. He has come up with a new activity as a fielding practice for his players, where they can earn points for completing catches.
Players are made to stand in the form of a N * M matrix with values assigned at all positions. If a Player at position (i2, j2) catches a ball from a player standing at (i1, j1), he is rewarded with points equal to the difference of values between the points: (i2, j2) and (i1, j1). Player1 can throw a ball to player2 only if player2 is located either towards right or down in the matrix. Provided that there is only one ball, your task is to determine the maximum reward that can be obtained collectively by the players. The catching can start from any player and can end at any player, and it must include at least two players.
Input Format:
The first line of input consists of two integers N and M denoting the number of rows and columns in the matrix.
The next N lines have M space separated integers denoting the values at each position in the matrix
Output Format:
You need to output the maximum reward that can be obtained by the players
N = 4 M = 4 matrix = [[1, 2, 13, 0], [15, 26, 7, 48], [99, 86, 11, 12], [92, 89, 0, 99]] return = 99
2 <= N, M <= 1000-1000 <= value(i,j) <=1000- Small Business Network: Degrees of SeparationPHONE SCREEN · Seen May 2026
- Set Total Palindrome Transformation CostSeen Feb 2026
- Smart Gardener (Intuit India)Seen Feb 2024
- Jumping Kady (Intuit India)Seen Feb 2024
- Longest Cipher (Intuit India)Seen Feb 2024
- Spreading Fire (Intuit India)Seen Feb 2024
- Virus Spread (Intuit India)Seen Feb 2024
- Ice Cream SticksSeen Feb 2024
public int maximumReward(int N, int M, int[][] matrix) {
// write your code here
}