From: Denis Hennessy Date: 2008-01-27T06:28:55+09:00 Subject: Re: [QUIZ] Making Change (#154) On 26 Jan 2008, at 20:33, Marcelo wrote: > On Jan 26, 2008 9:10 AM, Denis Hennessy wrote: >> Here's another test case: >> >> make_change 1000001, [1000000, 1] # => [1000000, 1] AND >> complete in a >> reasonable time (avoid brute force searches) > > Didn't you have something like this in mind instead? > > assert_equal([1_000_000, 1], make_change(1_000_001, [1_000_000, 2, > 1])) > > Marcelo > No. I just meant that exhaustive searches should be avoided. Where a large number of answer permutations are possible, they need to be pruned early. /dh