Reputation
Next privilege 100 Rep.
Edit community wikis
Badges
4
Newest
 Critic
Impact
0 people reached

  • 0 posts edited
  • 0 helpful flags
  • 7 votes cast
Jul
27
comment Strategy/algorithm to divide pot to chips
More specifically, it is the change-making/coin-change problem. While it is definitely analogous to the knapsack problem, it can be a little tough wrapping your head around the algorithm while thinking in terms of knapsacks and weight.
Jul
27
comment Strategy/algorithm to divide pot to chips
Dynamic programming is definitely the correct approach. It is worth mentioning that, depending on the chip denominations, you may have multiple optimal solutions for a given pot size. If you require a result that returns all of the optimal solutions, you'll have to modify the result array (in this case, MoneyArray) to store a list of solutions (which will be arrays themselves).
Jul
27
awarded  Critic
Jul
14
awarded  Supporter
Jul
14
awarded  Teacher
Jul
13
awarded  Autobiographer