Facebook Pixel

Minimum Path Sum

Problem Statement

Given an m × n grid filled with non-negative integers, find a path from the top-left corner to the bottom-right corner that minimizes the sum of all numbers along the path. You can only move right or down at each step.

For example:

[1, 3, 1]
[1, 5, 1]
[4, 2, 1]

The path 1 → 3 → 1 → 1 → 1 gives sum = 7, which is minimal.

Invest in Yourself
Your new job is waiting. 83% of people that complete the program get a job offer. Unlock unlimited access to all content and features.
Go Pro