FastPrepMinimum Starting Health in a Grid
Problems/Minimum Starting Health in a Grid

Minimum Starting Health in a Grid

Intuit logoIntuit● HardINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Intuit intern online assessment. The report says health may reach zero and does not give the allowed moves. Our task uses that wording with right and down moves. Our version is about 92% the same as the reported question.

You are given a non-empty rectangular integer matrix grid. Start at the top-left cell and reach the bottom-right cell by moving only right or down.

Entering a cell immediately adds that cell's value to your current health. Health may become exactly 0, but it must never become negative.

Return the minimum nonnegative health required before entering grid[0][0] so that at least one valid path reaches the destination without health becoming negative.

Function

minimumStartingHealth(grid: int[][]) → int

Examples

Example 1

grid = [[-2,-3,3],[-5,-10,1],[10,30,-5]]return = 6
grid
0120-2-331-5-10121030-5

With starting health 6, the path right, right, down, down produces health 4, 1, 4, 5, 0. Starting with less would make health negative along every valid path.

Example 2

grid = [[5]]return = 0
grid
005

Starting with 0 is allowed, and entering the only cell raises health to 5.

Example 3

grid = [[-4,10],[-10,-1]]return = 4
grid
010-4101-10-1

Starting with 4 and moving right then down gives health 0, 10, 9. Any smaller start becomes negative in the first cell.

Constraints

  • 1 <= grid.length <= 200.
  • 1 <= grid[i].length <= 200.
  • Every row has the same length.
  • grid.length * grid[0].length <= 40000.
  • -1000 <= grid[i][j] <= 1000.

More Intuit Online Assessment questions

  • 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
  • Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
  • Submask Sum QueriesOA · Seen Sep 2026

Similar questions at other companies

  • Cherry PickupInfosys · OAInfosys interview questions
  • Safest Shortest Path Through a GridSnowflake · OASnowflake interview questions
  • Minimum Cost Path with TeleportationsAmazon · OA
  • Largest Two Non-Overlapping Buildable SquaresAmerican Express · OAAmerican Express interview questions
  • Drone Delivery with Battery Swap StationsCisco · OACisco interview questions
  • Empty ShelfSquarepoint Capital · OASquarepoint Capital interview questions
  • Increasing Paths, part 2Hudson River Trading · OAHudson River Trading interview questions
  • Timed Coin Collection in a 2×N GridAtlassian · OAAtlassian interview questions
  • Maximum Sum RectangleDeloitte · OADeloitte interview questions
  • Longest Increasing Path in a MatrixNutanix · OANutanix 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 minimumStartingHealth(int[][] grid) {
        // Write your code here
    }
}
Checking account…