Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^3: Number from given digits puzzleby Anno (Deacon) |
on Mar 09, 2009 at 16:20 UTC ( [id://749336]=note: print w/replies, xml ) | Need Help?? |
Why, thanks. Quite the blast from the past after almost two years :)
Your praise is unjustified, however, because my solution is wrong. It doesn't find some valid results like (1 + 3)*(4 + 6) = 40 and others that can't be written without an initial parenthesis. The correct solution (as I believe) I came up with this time around is comparatively boring. Essentially it builds all arithmetic expressions that can be built from the original numbers, eval's them and sees if they match the target. In case anyone has picked up this ancient thread I'm appending it anyway. Anno
In Section
Seekers of Perl Wisdom
|
|