Блог пользователя send_nodes

Автор send_nodes, история, 9 лет назад, По-английски

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

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

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.