Shortest Unique Metric Tag
A medium Python mock interview question on DataDriven. Practice with AI-powered feedback, real code execution, and a hire/no-hire decision.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L5
Interview Prompt
A metrics platform stores fully-qualified metric names like 'bookings.checkout.success_rate'. Dashboards autocomplete a metric from any contiguous substring of its name, so each metric needs the shortest substring of its own name that does not appear inside any other metric's name. Given a list of metric names, return a list of the same length where the i-th entry is the shortest contiguous substring of metrics[i] that is not a substring of any other metric in the list. If multiple substrings of the same metric tie for the shortest length, return the lexicographically smallest one. If every substring of metrics[i] also appears in some other metric's name, return an empty string for that metric.
Summary
One token per metric. Make it unambiguous.
How This Interview Works
- Read the vague prompt (just like a real interview)
- Ask clarifying questions to the AI interviewer
- Write your python solution with real code execution
- Get instant feedback and a hire/no-hire decision