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!
Latest comments (8)
What is the expected output of the tests?
JavaScript solution:
Elm
Ruby
Also was in mood for some Haskell.
This time Haskell solution came out neater than Ruby's
JavaScript
Quick solution in my head with JS is sorting then comparing with each anagram: