Пример #1
0
        public List <List <int> > Combinations(int[] coins, int input)
        {
            var combos = new CoinChange();
            List <List <int> > listOfCombos = new List <List <int> >();
            var result = combos.FindPossibleCombinationsDynamicProgramming(input, coins);

            foreach (var list in result)
            {
                listOfCombos.Add(list);
            }
            return(listOfCombos);
        }
Пример #2
0
        public List <int> ShortestCombination(int[] coins, int input)
        {
            var combos   = new CoinChange();
            var result   = combos.FindPossibleCombinationsDynamicProgramming(input, coins);
            var count    = Int32.MaxValue;
            var shortest = 0;

            foreach (var VARIABLE in result)
            {
                if (VARIABLE.Count < count)
                {
                    shortest = result.IndexOf(VARIABLE);
                }
            }
            return(result[shortest]);
        }