2dbi
Home/Tesla/Minimum Path Sum
TTesla·DSASDE-1Technical Phone Screen

Minimum Path Sum

Problem

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

Example

grid = [[1,3,1],[1,5,1],[4,2,1]]
Output: 7

Constraints

  • 1 ≤ m, n ≤ 200

Approach

DP in place; explain time and space complexity — Tesla interviewers push on Big-O.

added 6 days ago
LeadersAccount