Are negative numbers and zero allowed to be a starting point or target? I'm assuming no, but I'd like a confirmation. ~ ryan ~ On Dec 30, 2005, at 8:37 AM, Ruby Quiz wrote: > The three rules of Ruby Quiz: > > 1. Please do not post any solutions or spoiler discussion for this > quiz until > 48 hours have passed from the time on this message. > > 2. Support Ruby Quiz by submitting ideas as often as you can: > > http://www.rubyquiz.com/ > > 3. Enjoy! > > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- > =-=-=-=-=-=-= > > by Christer Nilsson > > You have a starting point and a target, say 2 and 9. > > You have a set of three operations: > > double > halve (Odd numbers cannot be halved.) > add_two > > Problem: Move from the starting point to the target, minimizing the > number of > operations. > > Examples: > > solve(2,9) # => [2,4,8,16,18,9] > solve(9,2) # => [9,18,20,10,12,6,8,4,2] >