ErisSimp's blog

By ErisSimp, history, 2 days ago, In English

So currently, i was doing this problem that say

Given an array,you have to divide this array in to 2 bag,each element belong to 1 bag,find a way to do that the difference of the sum of these 2 bag is minimum.

I had made the observation that the result will not be greater than Max(a[i]),and did some dp and have passed. But i wasn't so sure that my observation is right or i just passed because of luck.

So i want to ask if it right or not.

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

»
2 days ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

my dp is dp[i][j],meaning if you can create 2 bag from a[1] to a[i] that difference is j