Below is the subset sum calculation that gives the result for simple array using LINQ.

Read from http://algorithmicalley.com/archive/2010/05/02/the-subset-sum-problem.aspx

List<int> list = new List<int> { 60, 45, 45, 45, 45, 30 }; var subsets = from m in Enumerable.Range(0, 1 << list.Count) select from i in Enumerable.Range(0, list.Count) where (m & (1 << i)) != 0 select list[i]; var result=subsets.First(set => set.Sum() == 180);

This result gives expected 45,45,45,45

But i want to this subset sum with Complex Object property, rather than int values

List<Group> groups = new List<Group>{new Group{Count=60}, new Group{Count=45},new Group{Count=45},new Group{Count=45}, new Group{Count=45},new Group{Count=30},new Group{Count=60}, new Group{Count=60},new Group{Count=15} };

Then

var subsets = from m in Enumerable.Range(0, 1 << groups.Count) select from i in Enumerable.Range(0, groups.Count) where (m & (1 << i)) != 0 select groups[i]; List<Group> subset =?????????? something like group.Count.Sum()==180

LINQ or any implementations are welcome. I have no idea about how to deal this LINQ to get my result.