From: Alex Shulgin Date: 2008-01-27T04:40:05+09:00 Subject: Re: Making Change (#154) On Jan 25, 5:50 pm, Ruby Quiz wrote: > > This week's Ruby Quiz is to complete a change making function with this > skeleton: > > def make_change(amount, coins = [25, 10, 5, 1]) > > end > > Your function should always return the optimal change with optimal being the > least amount of coins involved. You can assume you have an infinite number of > coins to work with. We have even richer set of common coins here in UA: [50, 25, 10, 5, 2, 1] (though 1 and 2 are rarely used, and there is also a coin with the value of 100, but it's not that common). BTW, is it reasonable to assume amount <= 100 or do we need to prepare for this one: def test_huge assert_equal([...], make_change(1_000_001) end ? -- I love this quiz, :-) Alex