Unscramble: a Programming Challenge
Unscramble is a short programming exercise inspired by the "Jumble" puzzle in the newspaper. Given a single, scrambled word, the program should return a matching entry from the English dictionary.
The Viget dev team loves a good challenge. When we're not solving problems for clients, Pointless Corp, and other internal projects, we also like doing it just for fun! And working through a programming exercise together is one way we do just that. In this post, I'll describe our newest challenge, Unscramble.
If this is new to you, check out OTP: a Language-Agnostic Programming Challenge and Romanize: Another Programming Puzzle.
First, a little background. The inspiration for this puzzle came from a fun and unexpected place: the newspaper.
In the popular version of the Jumble game, you're given a list of words to unscramble. Then, using certain marked letters from each solution, you must unscramble one last time into the word or phrase to complete the puzzle. See Jumble - Wikipedia for more information.
The Challenge #
Our challenge keeps it simple: write a program that can unscramble a single word, returning a matching entry from the English dictionary. Here's a quick example:
$ ./unscramble shast stash
Use any programming language you want! Bonus points for making it fast (try testing longer words, for example) as well as using a language that's new to you. Have fun with it.
Getting Started #
Everything you need to get started is on GitHub.
The repository includes a test suite with nine example jumbles to help validate your program is working correctly. Note that while it's easier to brute-force your way to a working solution, part of the fun of this one is optimizing for speed.
So far, we’ve created working solutions in these languages:
The fastest to date has been Joe Jackson's Rust implementation, clocking in around 0.09 seconds to run all nine assertions. But at the end of the day, this was never meant to be a competition. We had a good time, practiced problem-solving, and learned something new along the way.
Want to try it? We’d love to see how you approach the problem. Get started and send us a pull request when you're done.