Max Sum K-Partition

the problem in some of case

You simply need to find a max from every k elements and add it to the sum. This can be accomplished using the following very simple code.