I was doing this problem on iarcs. The problem is basically a variation of knapsack. Here we require to break set in two parts such that the difference between the sum of parts is minimum. I tried it using top down approach of dp but it is only getting 90 out of 100 points.Couldn’t figure out the mistake. My solution is here.

please help me out.