← Back to all problems
Medium

Minimum Path Sum

Updated Feb 24, 2026

Problem

Move only right or down; return min path sum to bottom-right.

Constraints

1 <= m, n <= 200

Examples

Example 1

Input: {"grid": [[1, 3, 1], [1, 5, 1], [4, 2, 1]]}
Output: 7

Function Signature

def minPathSum(self, grid: list[list[int]]) -> int

How to Submit

Implement a Solution class with a minPathSum method.

Your method will be called with the input parameters and should return the answer.