Object-Oriented Programming · Amazon · Medium
Create a basic autocomplete service backed by a collection of strings. Given any prefix, which may represent either an unfinished word or an entire word, return all stored words beginning with that prefix. add(word: str): Insert a word into the collection. search(prefix: str) -> List[str]: Produce the stored words whose beginnings match prefix. Requirements The collection holds at most 10^4 words. No word is longer than 10 characters. The supplied prefix is at most 10…
Checking your access…