Design classes and algorithm to solve well known 'build twit HTML' problem: given text: Some person has visited some place http://bit.ly/somelink, @twitterusername and a set of different replacements (position from, position to, type of replacement): 24, 34, entity 0, 11, entity 35, 57, link 60, 75, twitter username produce HTML to be displayed as a Twitter message: <strong>Some person</strong> has visited <strong>some place</strong> <a href="http://bit.ly/somelink">http://bit.ly/somelink</a>, @<a href="https://twitter.com/twitterusername">twitterusername</a>
Utilisateur anonyme
Solved in O(N), where N is the length of the initial source string. Sort the entities by starting position and proceed.