http://www.perlmonks.org?node_id=180484


in reply to Re(3): Puzzle: need a more general algorithm
in thread Puzzle: need a more general algorithm

Tempting, but the this is the "swapping bits" that I was referring to. The solution skips these three combinations:

01101 01110 10110

If you look at them closely, you'll see why you can't generate them. That's what got me stuck on this track. If that can be solved, this is a good way to go.

Oh, and since you mentioned this was untested, I won't comment about for my $bit ($splits-1..0) { :)

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.