I had an interesting interview problem today. Let's assume that we have n boxes, containing many numbers. For instance, let's say $n=4$, and four boxes contain the following numbers:
first box - (3, 2, 5) sum(first box) = 10 second box - (1, 7, 4, 8) sum(second box) = 20 third box - (10, 5, 9) sum(third box) = 24 fourth box - (11) sum(fourth box) = 11
Let's assume that we're given $'k'$, the number of times we could move a number from one box to another. What would be the best way to use that limited number of moves, so that
$max( sum(box_i) )$
which in the above case would be
max( sum(first box), sum(second box), sum(third box), sum(fourth box) )
For instance, in the above example, if $k=1,$ then the best move would be to move 5 or 9 to first or fourth box.
I was just using the greedy algorithm approach, but I was wondering if there are some well-known algorithms for this type of problem or similar type of problems.