Given an array containing N numbers, we need to split the array into two subsets, such that each subset contains N/2 numbers, and the difference between the sum of the two subsets is minimised. I was able to come up with this : asked 23 Aug '17, 00:43

Sort array in decreasing order. create 2 array of n/2 max size. insert element into those array using below condition.
for maximum cases it will give you correct result and for other will give close result. Another method is to try for all possible combination which is, of course, very slow. answered 03 Apr, 17:21

It may be done like this each time either pick the element or not and do this until you have N/2 elements and when you have picked N/2 elements then do this ans = min( ans, (sum_of_N_elems  sum_of_cur_N/2_elems) ). With this method you have to traverse many paths and complexity will be high so you can use dynamic programming to reduce complexity. answered 26 Aug '17, 15:45

Sorry ,i know its a bit late to ask,bt can u tell the constraint for n,a[i]?(assuming a is array)
This question was asked in an interview, the interviewer didn't mention any constraints.