Tag Enterprise Entities With Overlapping Multi-Word Synonyms
Last updated: November 29, 2026
Quick Overview
Given an employee utterance and a dictionary mapping multi-word synonym phrases to entity ids (apps, licenses, devices), choose a set of non-overlapping phrase matches that covers the most tokens, breaking ties by using fewer spans. Return the chosen spans with their entity ids.
Moveworks
November 29, 20260
0
0 solved
Given an employee utterance and a dictionary mapping multi-word synonym phrases to entity ids (apps, licenses, devices), choose a set of non-overlapping phrase matches that covers the most tokens, breaking ties by using fewer spans. Return the chosen spans with their entity ids.
Before or alongside an LLM, an assistant resolves mentions like "adobe acrobat pro license" against a tenant's catalog of software and access groups, where synonyms overlap heavily. The interviewer checks that you see why greedy longest-match fails and can combine a trie for match enumeration with a dynamic program over positions.
What the Interviewer Expects
- Explains a counterexample where greedy left-to-right longest match is suboptimal
- Builds a token-level trie to enumerate all matches starting at each position
- Defines dp over suffixes with a clear objective and tie-break
- Reconstructs the chosen spans from stored choices
- Analyzes complexity in terms of tokens and maximum phrase length
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you add fuzzy matching so "acrobt" still matches?
- Each entity has a prior popularity per tenant; how would you change the objective to maximize likelihood instead of coverage?
- How would you handle the same phrase mapping to two entities ("teams" the app vs a Teams group)?
- How would you serve this for a catalog of 2 million synonyms with low latency?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Tokenize by lowercased whitespace. A match is a contiguous token span equal to some synonym phrase. Choose non-overlapping matches maximizing covered tokens; on ties prefer fewer spans (longer, more s...
High-Level Design
Greedy fails: with phrases "a b", "b c d" and tokens a b c d, greedy takes a b and then cannot use b c d, covering 2 tokens; the optimum takes b c d (3 tokens). So: (1) build a trie over p...
Submit Your Answer
Moveworks Machine Learning Engineer Interview Guide
Interview process, tips, and preparation timeline