Minimum Total Cost to Merge Array into One Element

Given an integer array A. In one operation you pick any two elements a and b, remove them, and insert a+b back into the array. The cost of that operation is a+b. Return the minimum total cos...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: