Riddler Classic, May 22 2020

A fairly simple one this week, I think:

[W]hat is the longest word that doesn’t share any letters with exactly one state?

The word list is indicated, and “state” means a US state. It takes much longer to download the word list than to solve the first part of the problem!

The word list takes two or three seconds to download, and processing the word list to get the answer takes my code about 0.1s.  The extra credit code needs seven or eight seconds of processing time, but this is because it must process the entire word list, rather than just a few of the longest words.

I suspect that the code answering the main question couldn’t be much faster in Python (although I’d be happy to learn how, if I’m wrong!)  The extra credit code would probably be faster if the dictionary words were transformed into lists of letters first: if they were collected into a dictionary like this, with the dictionary value being the number of words that have the same transformation, there would be fewer lists of letters to check for “being mackerels”.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

I accept that my given data and my IP address is sent to a server in the USA only for the purpose of spam prevention through the Akismet program.More information on Akismet and GDPR.

This site uses Akismet to reduce spam. Learn how your comment data is processed.