Min Sum Path in Matrix

Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.

Note: You can only move either down or right at any point in time.

Example :

Input : 

    [  1 3 2
       4 3 1
       5 6 1
    ]

Output : 8
     1 -> 3 -> 2 -> 1 -> 1
Interview Code Editor
Hints
  • Solution Approach
  • Complete Solution
3541 successful submissions.
Asked In:
  • Amazon
Click here to jump start your coding interview preparation