Media.net interview question

Standard greedy arithmetic problems