word shifts

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Sun May 4 07:00:26 EDT 2008


George Sakkis:
> A faster algorithm is to create a 'key' for each word, defined as the
> tuple of ord differences (modulo 26) of consecutive characters.

Very nice solution, it uses the same strategy used to find anagrams,
where keys are
"".join(sorted(word))
Such general strategy to look for a possible invariant key for the
subsets of the required solutions is quite useful.

Bye,
bearophile



More information about the Python-list mailing list