Given a dictionary of words and multiple prefix queries, return all matching words in lexicographical order, returning an empty line when no matches exist.
This was asked in the Round 2: Coding stage, focused on Trie or Prefix Tree autocomplete and DFS traversal. In this SQL version, use the provided dictionary and prefix query tables.
query_id, prefix_text, and matching_words.matching_words must contain matching words separated by , in lexicographical order, or an empty string when there are no matches.query_id ascending.| Column | Type | Description |
|---|---|---|
| word_idPK | INT | Unique dictionary word identifier |
| word | VARCHAR(100) | Dictionary word to search |
| Column | Type | Description |
|---|---|---|
| query_idPK | INT | Identifier preserving the input query order |
| prefix_text | VARCHAR(100) | Prefix whose matching words should be returned |