Smarter algo, was Re: 03 digression by brute force
__peter__ at web.de
Fri Dec 14 03:21:23 EST 2018
jfong at ms4.hinet.net wrote:
> Just for fun:-) On my ooold PC, it takes 0.047 seconds to run the
> following algorithm on the problem 'SNED + MORE == MONEY".
> def tenThousand(u, Cin): # Cin == M
> global n
> if Cin == M:
> print(S, E, N, D, '+', M, O, R, E, '==', M, O, N, E, Y)
> n += 1
And it probably took under two minutes with the brute force approach.
So if you were only interested in the result the code below were efficient
only if it took at most two more minutes to write it;)
But seriously, the next step is to generalize this to work with arbitrary
More information about the Python-list