public static IEnumerable <int> TotalCoinsForEachCombination(RuntimeCoin c) { if (!c.Next.Any()) { return new[] { c.NumCoins } } ; return(c.Next.SelectMany(TotalCoinsForEachCombination).Select(x => x + c.NumCoins)); }
public static int NumCoinsForLeafNode(RuntimeCoin c) { return(c.NumCoins); }