Given a list of words and queries of the form "", answer true if some word has the query letters as prefix followed by exactly more characters (e.g. words [ball, apple], queries [ba2, app3] -> [True, False]).
Asked in the Onsite algorithms stage. Store the words and queries in the provided tables and write a PostgreSQL query to evaluate every query.
query_id, query_text, and boolean has_match.has_match = false.query_id ascending.| Column | Type | Description |
|---|---|---|
| word_idPK | INT | Unique word identifier |
| word_text | VARCHAR(100) | Word to test against queries |
| Column | Type | Description |
|---|---|---|
| query_idPK | INT | Unique query identifier |
| query_text | VARCHAR(100) | Prefix and length expression |