How to find a word from arrays of characters?

前端 未结 4 1446
感动是毒
感动是毒 2020-12-14 04:55

What is the best way to solve this:

I have a group of arrays with 3-4 characters inside each like so:

{p,     {a,    {t,    {m,
 q,      b,     u,            


        
4条回答
  •  孤街浪徒
    2020-12-14 05:17

    I just made a very large nested for loop like this:

    for(NSString*s1 in [letterList objectAtIndex:0]{
        for(NSString*s2 in [letterList objectAtIndex:1]{
           8 more times...
        }
    }
    

    Then I do a binary search on the combination to see if it is in the dictionary and add it to an array if it is

提交回复
热议问题