Solved LeetCode program · 802 of 1,000
#1039 · Minimum Score Triangulation of Polygon
Original English source
The values is a list of 3, 7, 4, and 5. The size is 4. The table is a list of 16 zeros.
For every gap from 2 to 3.
For every start from 0 to size minus 1 minus gap.
The finish is start plus gap. The cell is start times size plus finish. Set item cell of table to 1000000.
For every split from start plus 1 to finish minus 1.
The leftcell is start times size plus split. The rightcell is split times size plus finish. The candidate is item leftcell of table plus item rightcell of table plus item start of values times item split of values times item finish of values. If candidate is less than item cell of table, set item cell of table to candidate.
Show item 3 of table.
Expected stdout
144