Search⌘ K
AI Features

Solution: Minimum Path Sum

Solution: Minimum Path Sum gives you a grid of non-negative values. Find a path from its top-left to bottom-right corner using only right or down moves, and return the smallest path sum.

Statement

You are given an m × n grid containing non-negative integers. Your task is to find a path from the top-left cell to the bottom-right cell that minimizes the sum of the values along the path. At each step, you may move only right or down.

Constraints:

  • m == grid.length

  • n == grid[i].length ...