Search⌘ K
AI Features

Solution: Minimum Falling Path Sum

C# solution for the Minimum Falling Path Sum problem using the Dynamic Programming pattern.

Statement

Given a square integer matrix matrix of size n by n, return the minimum possible sum of a falling path through matrix.

A falling path starts at any element in the first row and chooses one element from each subsequent row. If the current element is at row r and column c, the next element must be in row r + 1 and in column c, c - 1, or c + 1, as long as the chosen column stays within the matrix bounds.

Constraints:

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

  • 11 \leq n 100\leq 100 ...