FastPrepMaximum Reward (Intuit India)
Problems/Maximum Reward (Intuit India)

Maximum Reward (Intuit India)

Intuit logoIntuit● MediumINTERNFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

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). Player 1 can throw a ball to player 2 only if player 2 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

Function

maximumReward(N: int, M: int, matrix: int[][]) → int

Examples

Example 1

N = 4M = 4matrix = [[1, 2, 13, 0], [15, 26, 7, 48], [99, 86, 11, 12], [92, 89, 0, 99]]return = 99
matrix
01230121301152674829986111239289099

Start with the ball at (0,3), where the value is 0. Throw it down to (1,3) for 48 - 0 = 48 points, then down to (2,3) for 12 - 48 = -36 points, then down to (3,3) for 99 - 12 = 87 points. The total is 48 - 36 + 87 = 99, the largest possible.

Constraints

  • 2 <= N, M <= 1000 -1000 <= value(i,j) <=1000

More Intuit interview questions

  • Number of IslandsONSITE INTERVIEW · Seen Nov 2026
  • VIP and Regular Service SchedulerPHONE SCREEN · Seen Nov 2026
  • Employee Promotion OpportunitiesOA · Seen Oct 2026
  • Next Pascal Row CoefficientOA · Seen Oct 2026
  • Parse Router LogsOA · Seen Oct 2026
  • Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
  • Maximum Square-Free DivisorOA · Seen Oct 2026
  • Two Tribes from Taller-Person CountsOA · Seen Oct 2026
  • Shortest Path from an Encoded GraphOA · Seen Sep 2026
  • Oldest and Youngest EmployeesOA · Seen Sep 2026

Similar questions at other companies

  • Grid Paths with Override PassesIMC Trading · OAIMC Trading interview questions
  • Largest Square of OnesOpenAI · OAOpenAI interview questions
  • Grid Paths with Override PassesMicrosoft · OAMicrosoft interview questions
  • Minimum Moves to Spread Stones Across a GridAmerican Express · OAAmerican Express interview questions
  • Largest Plus SignxAI · OAxAI interview questions
  • Calculate the Max ValueAmazon · OA
  • Largest Square of 1'sFactSet · OAFactSet interview questions
  • Longest Border-Ending Diagonal PatternZipRecruiter · OAZipRecruiter interview questions
  • Count Grid Words with One TurnCapital One · OACapital One interview questions
  • Minimum Falling Path SumScale AI · OAScale AI interview questions

Interview reports that mention this question

  • Intuit OA: What It Tests (2026)

Intuit interview experiences

  • Intuit Software Engineering Intern - Full Stack OA Format
All Intuit interview questionsSee Intuit hiring insights
Saved
class Solution {
    public int maximumReward(int N, int M, int[][] matrix) {
        // write your code here
    }

}
Checking account…