Minimum-Cost Array Reduction
Asked at MathWorks · Coding Questions · Difficulty: Medium · Last asked Jul 15, 2026
You have a collection of positive integers and must combine them into a single number. Each combine step takes any two numbers out of the collection, puts their sum back in, and costs exactly that sum. The order of the steps changes the total cost, because a value that is combined early is carried into every later sum that contains it. Return the smallest total cost that reduces the collection to one number.
Loading the problem…