Max Sum K-Partition

How can I use dynamic programming to solve this problem?
I cannot see any top down technique . Any Hints?

This is the code I tried

code https://ide.codingblocks.com/s/168205

Using bottom up everywhere is difficult at times.
Use recursive + memoization i suggest.

Can you please check the code and tell me why it’s giving run time error for all cases , it runs fine on my machine even the answer are also correct .

I am very sorry for this but i didn’t know you code in java.
Please open a new thread with same question so that some one else can take the fresh thread. :slightly_smiling_face: