James Gray
11/19/2004 5:27:00 PM
(redirected to Ruby Talk by JEG2)
On Nov 19, 2004, at 8:17 AM, Clark wrote:
> Hi James,
>
> Thanks for running the quiz.
My pleasure. Thanks for following the quiz and thank for the
corrections below.
James Edward Gray II
>> If you would like to see a very simple, if slow,
>> solution to the problem, have a look at Junghyun Kim's
>> submission.
>
> There is a problem with Junghyun's solution. I tried it
> with target 101 source 100, 3, 3, 17 and it returned the
> solution (17.0/(3.0-3.0))/100.0, which contains a division
> by zero.
>
>> As an aside, I'm not convinced the yields to "op1" and
>> "op2" are needed. I commented them out and was unable
>> to produce a failure, but it's possible I just didn't try
>> the right tests.
>
> The yields to "op1" and "op2" are needed in Brian's solution.
> They are the ones that make it possible to return a solution
> that contains a subset of the source numbers. Try the
> 101, [100, 3, 3, 17] example with those yields commented out
> and you will see.
>
> This was the first week, that I tried it. All my solutions
> were painfully slow. Hopefully this week I'll do better.
>
> Clark