NewProject Coding is here — build features and fix bugs in real codebases with an AI assistantSee what's new

(This question is a variation of the LeetCode question 1268. Search Suggestions System. If you haven't completed that question yet, it is recommended to solve it first.)

Given a list of business names bizNames and a series of prefix queries, implement an efficient search that returns all business names where at least one individual word starts with the given prefix. The match is case-insensitive. For each business name, if the prefix occurs in multiple words, only the first (leftmost) occurrence is considered for sorting.

Test Cases
Input
Output
Expected