Search
⌘K

Leetcode 1130. Minimum Cost Tree From Leaf Values

Given an array of positive integers as the in-order leaves of a full binary tree, choose the tree shape that minimizes the sum of internal-node values where each internal node's value equals the product of the largest leaf in its left and right subtrees. This is an optimal parenthesization/segmentation problem (n ≤ 40) often solved by DP or a monotonic-stack greedy strategy.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.