java string permutations and combinations lookup

后端 未结 6 557
北恋
北恋 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:00

    Use a Trie

    Instead of testing all N! possibilities, you only follow prefix trees that lead to a result. This will significanlty reduce the amount of strings that you're checking against.

提交回复
热议问题