Giter Club home page Giter Club logo

fiveletterworda's People

Contributors

thatmattparker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fiveletterworda's Issues

Repo description has a typo

It's the terrible python code (provably worse than normal)
Should be
t's the terrible python code (probably worse than normal)

Even faster solution: ~1 Minute

Sorry for mis-using the issues section here to share my results, but I couldn't resist ๐Ÿ˜„

My solution finds all 538 sets in around 50 seconds (with multi-threading on an 8-core CPU).

I'm not using fancy math (I know that's nothing to be proud of) but a few other tricks, which appear to speed things up a little:

  • Valid five-word sets must use 25 out of 26 characters. Therefore, I select words containing two rare letters
    (x and / or q, there are only 315 such words) and use only them as 'seed words'. Then I only have to find four
    more words per seed word. Because every valid set must contain either an x and / or a q I can't miss a set.

  • Initially, I build 26 sets (one for each letter) containing all words that include the particular letter. This
    helps in efficiently removing invalid word candidates later on.

  • The search function works recursively and removes invalid words from the list of candidates for deeper recursion
    levels (using the words-by-letter sets mentioned above). This way the search can terminate early once there are no more word candidates left.

The code is pretty simple (~150 lines including comments), however I used kotlin as programming language instead of python.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.