public (Disc disc, int targetWeight) GetUnbalancedChild() { var groups = ChildDiscs.GroupBy(x => x.GetTotalWeight()); var targetWeight = groups.First(x => x.Count() > 1).Key; var unbalancedChild = groups.First(x => x.Count() == 1).First(); return(unbalancedChild, targetWeight); }
public bool IsBalanced() { var groups = ChildDiscs.GroupBy(x => x.GetTotalWeight()); return(groups.Count() == 1); }