Back to problems

Substring Wrapper

Algorithm · Uber · Medium

Wrap Matching Substring in Each Word Medium · Topics · Company Tags · Hints You are given a sentence s composed of words separated by spaces, and a collection of strings called elements. For every word in s, you need to locate the earliest substring (starting from the leftmost position) that appears in elements. When you find such a substring, enclose it in square brackets [ ]. Keep these rules in mind: Matching respects letter case. If a single word could match more than…

Checking your access…