Setup
Pirates are notoriously bad at pronunciation. For this challenge, implement a function that will accept a jumbled word and a dictionary. It should output the words that the pirate might have been saying.
Example
grabscrab( "ortsp", ["sport","parrot","ports","matey"])
=> ["sport", "ports"]
Tests
grabscrab("trisf", ["first"])
grabscrab("oob", ["bob", "baobab"])
grabscrab("ainstuomn", ["mountains", "hills", "mesa"])
grabscrab("oolp", ["donkey", "pool", "horse", "loop"])
Good luck!
This challenge comes from matstc on CodeWars. Thank you to CodeWars, who has licensed redistribution of this challenge under the 2-Clause BSD License!
Want to propose a challenge idea for a future post? Email yo+challenge@dev.to with your suggestions!
Top comments (8)
Elm
JavaScript
JavaScript solution:
Quick solution in my head with JS is sorting then comparing with each anagram:
Ruby
Also was in mood for some Haskell.
This time Haskell solution came out neater than Ruby's
What is the expected output of the tests?