Scrabble word finder with wildcards

前端 未结 3 1430
借酒劲吻你
借酒劲吻你 2020-12-14 05:07

I’ve got a problem and it seems some before me have had similar problems but I haven’t been able to find a working solution for me.

I’m currently building a mobile w

3条回答
  •  心在旅途
    2020-12-14 05:28

    This will be very difficult to do if all you have is the dictionary. If you have the ability to make a new table or new columns, I would :

    Create a table with a column for the word, plus 26 columns (one for each letter) Run a stored proc/backend process that counts the occurences of each letter in a word, and puts them into the appropriate column.

    Then (ignoring wildcards) you can do

    Select word from dictionary where tcount <=2 and ecount <=1 and scount <=1

    for wildcards you could do and length <= number_of_letters

    Actually always use the length clause, because you will then be able to index on it to improve performance.

    Anything else is going to be exceptionally slow during the query

提交回复
热议问题