Minimum Path Sum

Problem Given an m x n grid of non-negative numbers, find the minimum path sum from top-left to bottom-right moving only right or down.

Input / Output

  • Input: int grid[m][n]. Output: minimum path sum.

Constraints

  • 1 <= m, n <= 200; O(m*n) expected.

Example

  • [[1,3,1],[1,5,1],[4,2,1]] → 7 (1→3→1→1→1).
asked …
LeaderboardSalaryAccount