Tap here to switch tabs
Problem
Ask
Submissions

Problem: Triangle

med
30 min
Explore how to find the minimum path sum from top to bottom in a triangle array by moving to adjacent numbers in the row below. This lesson helps you understand dynamic programming approaches to efficiently solve this optimization problem and implement code solutions.

Statement

Given an array, triangle, return the minimum path sum from top to bottom.

You may move to an adjacent number in the row below at each step. More formally, if you are at index ii in the current row, you may move to either index ii or index i+1i + 1 in the next row.

Constraints:

  • 11 \leq triangle.length 200\leq 200

  • triangle[0].length ==1== 1

  • triangle[i].length == triangle[i - 1].length + 1

  • 104-10^4 \leq triangle[i][j] 104\leq 10^4

Tap here to switch tabs
Problem
Ask
Submissions

Problem: Triangle

med
30 min
Explore how to find the minimum path sum from top to bottom in a triangle array by moving to adjacent numbers in the row below. This lesson helps you understand dynamic programming approaches to efficiently solve this optimization problem and implement code solutions.

Statement

Given an array, triangle, return the minimum path sum from top to bottom.

You may move to an adjacent number in the row below at each step. More formally, if you are at index ii in the current row, you may move to either index ii or index i+1i + 1 in the next row.

Constraints:

  • 11 \leq triangle.length 200\leq 200

  • triangle[0].length ==1== 1

  • triangle[i].length == triangle[i - 1].length + 1

  • 104-10^4 \leq triangle[i][j] 104\leq 10^4