(Solved) : Amazon Media Encoder Highly Scalable Easy Use Cost Effective Way Developers Businesses Con Q39724992 . . .

amazon media encoder is highly scalable easy to use andcost-effective way for developers and businesses to convert mediafiles from their source format into versions that will playback ondevices like smartphones. Whenever a media file needs to beprocessed by the necoder, it partitions the media file into Nsubfiles. Each subfile is processed independently. During thisprocess each sub file gets compressed. These compressed sub filesare then merged by the encoder.

The encoder can merge only two files at a time. The timerequired to merge the two files is equal to the sum of theirsizes.The size of this merged file is also equal to the sum oftheir sizes . This process is repeated until the N sub files aremerged into a single output file.

Write an function to output the minimum possible time to mergethe given N subfiles into a single file.

Input

The input to the function/ method consists of two arguments:

numofSubFiles, an integer representing the number of thesubfiles;

files, a list of integers representing the size of thecompressed subfiles

Output

Return an integer representing the minimum time required tomerge all the subfiles.

Constraints

2<=numofSubfiles<=106

1<= files[i]<=106

0<= i<numofSubFiles

Example

Input:

numofSubFiles = 4

files = [4, 8, 6, 12]

output

58

Explanation:

The optimal way to merge the subfiles is as follows:

Step1: Merge the files of size 4 and 6 (time required is 10).Size of subfiles after merging: [8, 10, 12]

Step2: Merge the files of size 8 and 10 (time required is 18).Size of subfiles after merging; [18, 12]

Step 3: Megre the files of size 18 and 12 (time required is30)

Total time required to merge the file is 10+18+30 = 58

Expert Answer


Answer to amazon media encoder is highly scalable easy to use and cost-effective way for developers and businesses to convert medi…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?