I want to split poker pot to chips.
Example:
Pot = $17.500.
I have the endless piles of chips. I have the following types of chips: ChipsTypes = [$1, $5, $10, $25, $100, $500, $1.000, $5.000, $10.000, and so on]. Index starts from 0.
I want to get an array that says which chips I have to take to divide the pot and in which order to have minimum number of denominations and chips after pot-to-chips conversion. For example Result = [7, 5] means that I have to take 3 * $5.000 + 5 * $500 which $17.500.
Is there is any strategy or algorithm that would suit my need?
Best Answer
It sounds to me like you are attempting to solve the Knapsack Problem if you want a general solution where any denominations would work.
Put in those terms this is an unbounded knapsack problem where all the values are -1 and the weights are the denomination of the chip.
You should be able to find lots about the problem online.