Minimum Score Triangulation of Polygon
Given a convex polygon with n vertices labeled by the array values in clockwise order, triangulate it into n-2 triangles. Each triangle's score is the product of its three vertex labels, and the triangulation's total score is the sum of those products. Return the minimum possible total score over all triangulations.
Open official problem prompt ↗Find the cheapest way to cut a convex polygon into triangles when each triangle costs the product of its corner labels.
Like framing a stained-glass panel from a wide pane: you pick one diagonal beam at a time, which necessarily leaves two smaller panes you frame independently, and you want the cheapest set of beams overall.
- Input
- values = [3, 7, 4, 5]
- Output
- 144
- Why
- Triangulating with the diagonal 3-4 gives triangles (3,7,4)=84 and (3,4,5)=60, totaling 144, the minimum.
n == values.length3 <= n <= 501 <= values[i] <= 100