This is what I understood from the question let me know what i missed
link: https://ide.codingblocks.com/s/177797
Max Sum K Partition
Hey @Codemaniac_Aditya
Try to understand the question again. Its like placing the array elements in a 2D matrix with K rows and ceil(N/K) columns and some missing elements.
But how is it 2D as according to hint video the dp array was made by checking the previous max1 max2 and maxindex itself
Let me rephrase it. If you look at the input in this form, it’ll help to understand the video solution better.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
Not clear yet, still I am getting as I have to maintain three variables for each partition max1, max2, max1index, and doing sum with max1 and the current if (i-j) != k else sum with max2
Finding it too complex in the given hint, can you please tell me what to change in my code link:https://ide.codingblocks.com/s/177797
Your code is not taking into consideration the fact that you can’t pick maxInd, secMaxInd in same group. For each sub group of size k, take current mx and secMx and prevMx, prevSecMx.