Let's say that merging two arrays take the sum of the size of each array.
If we are merging two arrays of length 100 and 250, it would take 350ms.
You are given an array of array sizes, and are supposed to find the shortest time that it would take to merge the all the arrays.
Example)
Given the list A = [100, 250, 1000], first we would merge 100 + 250 = 350, and merge 350 + 1000 = 1350. The total shortest time that it takes to merge all arrays is 1700.
How do we solve this problem efficiently given the unsorted array of array sizes?
I can only think of solution that is sorted.