Most optimal coin fit for a given sum of money
问题 How would you reach a given sum in the most optimal manner possible given a set of coins ? Let's say that in this case we have random numbers of 1, 5, 10, 20 and 50 cent coins with the biggest coins getting the priority. My first intuition would be to use all the biggest coins possible to fit and then use up the next smallest coin in value if the sum is exceeded. Would this do or are there any shortfalls to this approach ? Are there any more efficient approaches ? 回答1: There are shortfalls to