Given a set of numbers, divide the numbers into two subsets such that difference between the sum of numbers in two subsets is minimal.
T
Many answers mentioned about getting an 'approximate' solution in a very acceptable time bound . But since it is asked in an interview , I dont expect they need an approximation algorithm. Also I dont expect they need a naive exponential algorithm either.
Coming to the problem , assuming the maximum value of sum of numbers is known , it can infact be solved in polynomial time using dynamic programming. Refer this link https://people.cs.clemson.edu/~bcdean/dp_practice/dp_4.swf