Given n numbers find the way to assign them to blocks of 3 (and possible one block of 1 or 2 if n is not divisible by 3) so that sum of smallest elements from each full block is maximal.
ie. numbers 400, 350, 300, 250, 200, 150, 100, can be divided into [400, 350, 300], [250, 200, 150], [100] with above mention sum of 450.
I know that correct approach is just to assign numbers to block in sorted order(so first block contains first, second and third largest element and so on), but i can't find a way to prove it correctness.