Tap here to switch tabs
Problem
Submissions

Problem: Minimum Falling Path Sum

med
30 min
Try to solve the Minimum Falling Path Sum problem.

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

  • 1≤1 \leq n ≤100\leq 100

  • −100≤-100 \leq matrix[i][j] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Falling Path Sum

med
30 min
Try to solve the Minimum Falling Path Sum problem.

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

  • 1≤1 \leq n ≤100\leq 100

  • −100≤-100 \leq matrix[i][j] ≤100\leq 100