DEV Community

Discussion on: Leetcode 1268 : Search Suggestions System (Trie Approach)

Collapse
 
cyrilantony89 profile image
cyrilantony89 • Edited

"Building Trie cost time O(m * m * n)"
This statement is incorrect. Building is O(m * n). And search is O(m).
So total is O(m * n) + O(m) ; which is eventually O(m * n)

And space complexity is O ( 24 * 3 * m ) => O(m)

Collapse
 
rohithv07 profile image
Rohith V

Thank you for the feedback, I will really have a look into this.