Word Jumble Algorithm

后端 未结 5 1350
执笔经年
执笔经年 2021-01-18 02:04

Given a word jumble (i.e. ofbaor), what would be an approach to unscramble the letters to create a real word (i.e. foobar)? I could see this having a couple of approaches, a

5条回答
  •  花落未央
    2021-01-18 02:33

    Create all the permutations of the string, and look them up in a dictionary.

    You can optimize by looking up shorter strings that begin words, and if there are no words of suitable length in the dictionary that start with those strings, eliminating permutations starting with those letters from further consideration.

提交回复
热议问题