Extract Company Tickers from News
Updated
Problem statement
Given a news article, parallel arrays of company names and ticker symbols, return the tickers for companies mentioned in the article.
For this exercise, assume matching is case-insensitive over maximal alphanumeric words, while punctuation separates words. Company names may contain multiple words. Scan from left to right; when several names begin at the same word, select the longest name. Return each ticker only on its first matched mention.
Function
extractTickers(news: String, companyNames: String[], tickers: String[]) → String[]Examples
Example 1
news = "Apple partnered with Goldman Sachs; Apple shares rose."companyNames = ["Apple","Goldman Sachs"]tickers = ["AAPL","GS"]return = ["AAPL","GS"]The first mentions occur in the order Apple, then Goldman Sachs. The second Apple mention does not duplicate AAPL.
Example 2
news = "The New York Times expanded coverage in New York."companyNames = ["New York","New York Times"]tickers = ["NY","NYT"]return = ["NYT","NY"]The longest name wins at the first position. The later standalone New York mention then adds NY.
Constraints
0 <= news.length <= 2 * 10^51 <= companyNames.length = tickers.length <= 10^4- Normalized company names are unique and nonempty.
- The total company-name length is at most
2 * 10^5.
More Susquehanna International Group (SIG) interview questions
- AKQ Betting Game EquilibriumONSITE INTERVIEW · Seen May 2025
- Correct Three Protractor ReadingsONSITE INTERVIEW · Seen May 2025
- Estimate X from the Sum of Two NormalsONSITE INTERVIEW · Seen May 2025
- Catch Fish with Reusable BaitsOA · Seen Nov 2026
- Bold Play to Reach a GoalOA · Seen Nov 2026
- Cats, Truth and Who Has MoreOA · Seen Nov 2026
- Counting Cows by Their LegsOA · Seen Nov 2026
- Enough Muffins for the LineOA · Seen Nov 2026
- Expected Consecutive Pairs Among Chosen NumbersOA · Seen Nov 2026
- Four-by-Four Boundary GridOA · Seen Nov 2026
Similar questions at other companies
- Highlight and Rank Overlapping CitationsHarvey · ONSITE INTERVIEWHarvey interview questions
- Word Break IIAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Word Break IIBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
- Transform Dotted Keys into a Nested MapProofpoint · ONSITE INTERVIEW
- Longest-Match Tokenizer with Unknown SymbolsAnthropic · ONSITE INTERVIEWAnthropic interview questions
- Dynamic Prefix Query CountsGoogle · ONSITE INTERVIEWGoogle interview questions
- In-Memory Directory and File OperationsSquarepoint Capital · ONSITE INTERVIEWSquarepoint Capital interview questions
- File System PathsCapital One · ONSITE INTERVIEWCapital One interview questions
- Word Break IIWex · PHONE SCREEN
- Phrase Covering the Most WordsZip · PHONE SCREENZip interview questions