Algorithm · Apple · Medium
Given a list of keywords words together with a string s, surround every occurrence of each words[i] found in s with bold markup. Characters enclosed by and are displayed in bold. Return the updated version of s containing the bold tags. Use the fewest possible tags, and ensure the resulting tags are properly matched. Examples Example 1: Explanation: "xy" starts at index 1 and "yz" starts at index 2. Because these selected spans overlap, they combine into one bold segment…
Checking your access…