Back to problems

Implement Trie with Non-Standard Alphabet

Algorithm · Snowflake · Medium

Custom Alphabet Trie Medium · Topics · Company Tags · Hints Implement a prefix tree (trie) that works with an arbitrary alphabet. The alphabet is supplied as a string alphabet consisting of distinct characters. Your trie must support the following three operations: insert(word: str): Add word to the trie. search(word: str) -> bool: Return true if word exists in the trie, otherwise false. startsWith(prefix: str) -> bool: Return true if at least one word in the trie begins…

Checking your access…