FastPrepMinimum Path Sum
Problems/Minimum Path Sum

Minimum Path Sum

Amazon logoAmazon● MediumNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Amazon Experience 92 reports this problem by name, from an onsite interview. Our function signature and fixed rules are the same as in our existing, tested version of this problem.

Given a nonempty rectangular matrix grid of nonnegative integers, start at the top-left cell and reach the bottom-right cell.

At each step, move exactly one cell right or one cell down. Return the minimum possible sum of the values on the path, including both endpoints.

Function

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

Examples

Example 1

grid = [[1,3,1],[1,5,1],[4,2,1]]return = 7
grid
012013111512421

The path 1, 3, 1, 1, 1 has sum 7.

Example 2

grid = [[1,2,3],[4,5,6]]return = 12
grid
01201231456

Moving right, right, then down gives 1 + 2 + 3 + 6.

Example 3

grid = [[1,99,1],[1,99,1],[1,1,1]]return = 5
grid
01201991119912111

Advanced contract case 7.

Constraints

  • 1 <= grid.length, grid[0].length <= 500
  • Every row has the same length.
  • 0 <= grid[r][c] <= 10000
  • The answer fits in a signed 32-bit integer.

More Amazon Onsite Interview questions

  • Number of IslandsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Cheapest Flights Within K StopsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course Schedule IIPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Dungeon GameONSITE INTERVIEW · Seen Nov 2026
  • Integer BreakONSITE INTERVIEW · Seen Nov 2026
  • LFU CacheONSITE INTERVIEW · Seen Nov 2026
  • LRU Cache for Query ResultsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Count Adjacent Symbol Pairs for BPEONSITE INTERVIEW · Seen Nov 2026
  • First Non-Repeating CharacterOA · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Maximum All-Ones Square Side LengthOmnissa · ONSITE INTERVIEWOmnissa interview questions
  • Minimum Path SumMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Minimum Path SumBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Bomb Enemy Best CoordinatesSambaNova Systems · ONSITE INTERVIEWSambaNova Systems interview questions
  • Largest Square of Ones in a GridExpedia · ONSITE INTERVIEWExpedia interview questions
  • Longest Increasing Path in a MatrixNew Relic · PHONE SCREEN · ONSITE INTERVIEW
  • Longest Increasing Path in a MatrixVisa · ONSITE INTERVIEWVisa interview questions
  • Maximal Rectangle in a Binary MatrixGoogle · ONSITE INTERVIEWGoogle interview questions
  • Find Robots by Blocker DistancesUber · PHONE SCREENUber interview questions
  • Largest Square of OnesOpenAI · OAOpenAI interview questions

Amazon interview experiences

  • Amazon SWE OA with AI Coding: 1 Experience
  • Amazon SWE Intern Phone Screen Interview Experience: 1 Experience
  • Amazon New Grad SDE I OA and Virtual Onsite: 1 Experience
  • Amazon BIE Intern SQL and Interview Questions: 17 Experiences
  • Amazon Experienced SWE AI-Assisted Debugging OA: 1 Experience
  • Amazon SDE II (L5) Interview Questions: 5 Experiences
See Amazon hiring insights
Saved
class Solution {
    public int minimumPathSum(int[][] grid) {
      // write your code here
    }
}
Checking account…