Problem 1130 · Medium

Minimum Cost Tree From Leaf Values

Build a tree from an ordered list of leaf values so that the total cost of its nonleaf nodes is as small as possible. Adjacent pairs are merged with the smaller product first.

Open the interactive visualisation