211. Design Add and Search Words Data Structure

211. Design Add and Search Words Data Structure Design a data structure that supports adding new words and finding if a string matches any previously added string. Implement the WordDictionary class: WordDictionary() Initializes the object. void addWord(word) Adds word to the data structure, it can be matched later. bool search(word) Returns true if there is any string in the data structure that - matches word or false otherwise. word may contain dots ‘....

<span title='2021-05-06 00:00:00 +0000 UTC'>May 6, 2021</span>&nbsp;·&nbsp;4 min&nbsp;·&nbsp;volyx

720. Longest Word in Dictionary

720. Longest Word in Dictionary Given an array of strings words representing an English Dictionary, return the longest word in words that can be built one character at a time by other words in words. If there is more than one possible answer, return the longest word with the smallest lexicographical order. If there is no answer, return the empty string. 1 2 3 4 5 Example 1: Input: words = ["w","wo","wor","worl","world"] Output: "world" Explanation: The word "world" can be built one character at a time by "w", "wo", "wor", and "worl"....

<span title='2021-05-04 00:00:00 +0000 UTC'>May 4, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx