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 questions
Given a list of Nodes, each with a unique string id and a list of subnodes it depends on, find the maximum depth of the dependencies.Find the shortest contiguous substring of a sentence containing all words of another string.Find the variance in a substring.Related courses

Course

Course
Course
