Question bank › Trie
Dsa Trie Medium

Unique Word Finder

You are tasked with creating a unique word finder that processes a list of sentences and returns only the unique words. Implement a class called `UniqueWordFinder` with the following methods: 1. `add_sentence(sentence: str)`: Adds a sentence to the finder, normalizing the words to lowercase and ignoring punctuation. 2. `get_unique_words() -> List[str]`: Returns a sorted list of unique words across all added sentences. The input will consist of multiple 'ADD sentence' commands followed by 'END'. Input Format: - Each command is on a new line. The last line contains a command 'END'. Output Format: - Output the unique words sorted in lexicographical order on a single line, space-separated. Example: Input: ADD Hello world! ADD Hello everyone. ADD Goodbye world! END Output: everyone goodbye hello world

Key concepts

triestring-processingset

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.