in reply to Re^3: Another word puzzle with too many permutations
in thread Another word puzzle with too many permutations
The given puzzle solves in 1-2 secs, and takes about 3 minutes for a full pass (return instead of exit).DOG: for my $dog (@_) { my $remaining = $letters; $remaining =~ s/$_//i or next DOG for split //, $dog; push @remain, $remaining; push @dogs, $dog; } while( my $dog = shift @dogs ) { dogtree( "$tree $dog", shift @remain, @dogs ); }
|
|---|