Hi, I was having some trouble on figuring out the solution to this
It's obviously some sort of DP, and by looking at some code, I can tell that they are using left and right pointers, but I am unable to grasp the overall solution. Could someone please let me know the solution :D
Hint: what if, instead of writing (either prefix sum or suffix sum), you wrote (minimum of prefix sum and suffix sum)? Since you know the sum of the whole array, you can convert it into this form.