java string permutations and combinations lookup

后端 未结 6 525
北恋
北恋 2021-01-02 08:35

I\'m writing an Android word app. My code includes a method that would find all combinations of the string and the substrings of a 7 letter string with a minimum of

6条回答
  •  一生所求
    2021-01-02 09:03

    See here: How to find list of possible words from a letter matrix [Boggle Solver]

    The idea behind the code in the answers is as follows:

    • Iterate over each word dictionary.
    • Iterate over each letter in the word, adding it to a string and adding the string each time to an array of prefixes.
    • When creating string combinations, test to see that they exist in the prefix array before branching any further.

提交回复
热议问题