Skip to main content
All Questions

Find and underline the shortest unique substring of each entry in a list.

Unlock detailed company stats for this questionUpgrade

A web UI has a drop-list selector widget that matches any substring. To help users memorize shortcuts, highlight the shortest possible substring that uniquely matches each entry in the list. In case of ties use the first substring. Return the same list where each string has its unique substring surrounded by <u> and </u>. Matching is case insensitive, but the returned values must preserve the original casing, and the string order must be preserved. Example: ["Bird", "Cat", "Cow", "Dog", "Wallaby"] returns ["B<u>i</u>rd", "Ca<u>t</u>", "<u>Co</u>w", "Do<u>g</u>", "Wa<u>l</u>laby"]. A similar LeetCode problem is Shortest Uncommon Substring in an Array.

Community answers

No answers contributed by the community yet.

Related courses

Course

Software Engineering Interview Prep

Land your dream software engineering role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates—practice data structures, algorithms, system design, people management, behavioral interviews, and more.

Course

System Design Interviews

Learn how to answer the latest system design questions across product, infrastructure, and AI domains. Features in-depth video examples, written breakdowns, and helpful reference patterns. Watch senior engineers and managers answer these questions in mock interview videos.