send_nodes's blog

By send_nodes, history, 9 years ago, In English

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

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
9 years ago, # |
  Vote: I like it +6 Vote: I do not like it

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.