|Problems? Is your data what you think it is?|
Shortest string containing all from 0000 to 9999 challenge.by EvdB (Deacon)
|on May 22, 2003 at 08:00 UTC||Need Help??|
Here is something for the monks to mull over on the weekend. It is not a perl specific thing but I fear that large amounts of perl ingenuity will be required to solve it.
Q: What is the shortest string that contains all the numbers from 0000 to 9999.
For example: '012345678' contains 0123, 1234, 2345, 3456, 4567, 5678.
Is it possible to create a string which contains all the numbers and no duplicates? To date my best achievement is:
Please feel free to use this function to test any strings produced:
My thoughts on this puzzle are that you can go about it one of two ways: add unused numbers to the end of the string (technique used for results above) or remove duplicates. Probably the best is a combination of both.
Update: Made a change to the analysis code - pesky CVS caught me out.
--tidiness is the memory loss of environmental mnemonics