As reported: SIG phone screen 2 (Spring 2026): given a list of headlines and company name → ticker pairs, load the names into a trie with the tickers at the terminal nodes, then fetch every ticker that appears in a headline. All tickers in the string must be found — for example, if both "Big global company" and "global" have tickers, the headline "Big global company does the thing" returns both. An OOP design question followed.
You are given companies, a list of [name, ticker] pairs, and a list of headlines. A company is mentioned in a headline when the words of its name appear in the headline as consecutive whole words.
For each headline, return the tickers of all mentioned companies, sorted and without duplicates. Use a trie over words: insert every company name, store its ticker at the node where the name ends, and scan each headline from every starting word.
Example 1
companies = [["Big global company","BGC"],["global","GLB"],["Acme","ACM"]]
headlines = ["Big global company does the thing","Acme buys a big company","Nothing to see"]
Output: [["BGC","GLB"],["ACM"],[]]
"Big global company" and the nested "global" are both found. "big company" is not "Big global company".
Example 2
companies = [["Apple","AAPL"],["Apple Hospitality","APLE"]]
headlines = ["apple hospitality REIT beats apple","Pineapple sales up"]
Output: [["AAPL","APLE"],[]]
"Pineapple" is a different word, so it does not mention Apple.
Constraints: up to 10^4 companies with names of 1–5 words; up to 10^4 headlines of up to 50 words; words are separated by whitespace; tickers are distinct.
Code runner format: one JSON value per line: companies, then headlines. Implement findTickers(companies, headlines).
Clarifications
- Matching ignores case and compares whole words only; runs of spaces count as one separator.
- Each ticker appears once per headline, however often the company is mentioned.