Given a dictionary and a list of letters find all valid words that can be built with the letters

前端 未结 12 890
闹比i
闹比i 2021-01-31 12:26

The brute force way can solve the problem in O(n!), basically calculating all the permutations and checking the results in a dictionary. I am looking for ways to improve the com

12条回答
  •  暖寄归人
    2021-01-31 12:41

    A better way to do this is to loop through all the words in the dictionary and see if the word can be built with the letters in the array.

提交回复
热议问题