divide list in two parts that their sum closest to each other
问题 This is a hard algorithms problem that : Divide the list in 2 parts (sum) that their sum closest to (most) each other list length is 1 <= n <= 100 and their(numbers) weights 1<=w<=250 given in the question. For example : 23 65 134 32 95 123 34 1.sum = 256 2.sum = 250 1.list = 1 2 3 7 2.list = 4 5 6 I have an algorithm but it didn't work for all inputs. init. lists list1 = [], list2 = [] Sort elements (given list) [23 32 34 65 95 123 134] pop last one (max one) insert to the list which differs