why not just use a trie?


  • 0
    E

    seems not only easier, but faster as you can achieve O(n) performance, with O(Nalphabet_sizekey_length) space complexity


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.