Max Sum K Partition

unable to think about how to keep a record of max1, max2, maxindex for each subarray