Maximum Sum K partition Java

code - https://ide.codingblocks.com/s/219312

This code works for all the basic testcases that but fails all when submitted , any suggestions for what values it is not working?

@ranaabhinav50
This is actually a very difficult problem. So I recommend you see the solution and use this knowledge to solve further questions.

So Now I have copied the exact same code It still doesn’t work .
please take a look .
code :- https://ide.codingblocks.com/s/233235

Please have a look at this problem.