From: Christer Nilsson Date: 2005-12-31T09:08:08+09:00 Subject: Re: Numeric Maze (#60) Robert Retzbach wrote: > J. Ryan Sobol schrieb: > >> this question? For example, >> >> ~ ryan ~ >> >> PS- I'm new here and I hope I'm not over overstepping the rules. >> >> >> >> > Hello. > I really enjoyed this puzzle, but my brain and my cpu are burning. > > In a german ruby channel we used the example 22->999. > My really slow brute force algo came up with > 122002000200212 > > 0 - double > 1 - halve > 2 - add_two > > It took 20-30min :D > > 1->15 : 2000021, took about .5s > > But thinking about a no BF solution makes my head hurt :( > I have created some algos but they all don't find the shortest way. > > I also have to mention that there are often more than 1 'shortest' ways. > > I exspect the best of you! > Good luck. Robert, your solution is correct. There may be different solutions with the same number of steps. [22, 24, 26, 28, 30, 60, 62, 124, 248, 496, 498, 996, 1992, 1994, 997, 999] [22, 11, 13, 15, 30, ...] I agree, it shouldn't take so long time. Try shaving off one magnitude. Christer -- Posted via http://www.ruby-forum.com/.