standupmaths / fiveletterworda Goto Github PK
View Code? Open in Web Editor NEWIt's the terrible python code (provably worse than normal) from the Stand-up Maths video about five five-letter words: https://youtu.be/_-AfhLQfb6w
License: MIT License
It's the terrible python code (provably worse than normal) from the Stand-up Maths video about five five-letter words: https://youtu.be/_-AfhLQfb6w
License: MIT License
It can be renamed to fiveletterwords
without breaking links! Just go to the repo settings
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.
I left a YT comment, but apparently YT doesn't like me and just deleted it. Brute force solution with bit twiddling and avoiding duplicate work runs in <1 min for the original word list on my computer and finds all 538 sets.
https://github.com/ahouts/five-letter-words
It's the terrible python code (provably worse than normal)
Should be
t's the terrible python code (probably worse than normal)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.