Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Minimum Cost Tree From Leaf Values

Medium Interval DP

Given the in-order leaf values of a binary tree in which every non-leaf node has two children and its value is the product of the largest leaf in its left subtree and the largest leaf in its right subtree, print the minimum possible sum of all non-leaf node values.

Constraints

2 <= n <= 40 1 <= value <= 15

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.