Company: Agoda_16nov
Difficulty: medium
Text Formatting Problem Description A simple text editor has been used to create a document. A function must be created to add tags for bold, italic and underline to each character. Once applied to a character, the formatting cannot be removed. The formatting must be applied in the order presented. Determine the minimum number of operations required to format the text. A single operation consists of either one of the following: 1. Select a contiguous segment of the text in the text area for styling 2. Select bold/italics/underlined button in the text editor menu to apply the selected style on the selected segment of text Note that in order to style a segment of text, it must first be selected. Examples Example 1: Consider the following inputs: starting = [1, 3, 9, 5, 5] ending = [5, 8, 10, 6, 6] style = ['b', 'b', 'i', 'u', 'u'] Aligning the three arrays by index, the following styling commands are to be performed: - [1,5]: bold - [3,8]: italics - [9,10]: bold - [5,6]: italics - [9,10]