bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
MediumIntervalsLC 758

Bold Words in String

Given an array of keywords words and a string s, make all appearances of all keywords words[i] in s bold. Any letters between and tags become bold. Return s after adding the bold tags. The returned string should use the least number of tags possible, and the tags should form a valid combination.

Asked at 1 company
Google
Hints
  • 1.Think about which data structure fits best
  • 2.Consider the time complexity of your approach
  • 3.Look for patterns in the constraints
LeetCode