You are going to implement the most powerful editor for integer sequences. The sequence is empty when the editor is initialized. There are 5 types of instructions. I x Insert x after the cursor. D Delete the element before the cursor. L Move the cursor left unless it has already been at the begin.R Move the cursor right unless it has already been at the end. Q k Suppose that the current sequence BEFORE the cursor is {a1,a2…an}. Find max1≤i≤kSimax_{1leq ileq k} S_imax1≤i≤kSi whereS;=a1+a2++aS_; = a_1 +a_2+··+ a_S;=a1+a2++a
You are going to implement the most powerful editor for integer sequences. The sequence is empty when the editor is initialized. There are 5 types of instructions. I x Insert x after the cursor. D Delete the element before the cursor. L Move the cursor left unless it has already been at the begin.R Move the cursor right unless it has already been at the end. Q k Suppose that the current sequence BEFORE the cursor is {a1,a2…an}{ a_1,a_2dots a_n }{a1,a2…an}. Find max1≤i≤kSimax_{1leq ileq k} S_imax1≤i≤kSi where S;=a1+a2+⋅⋅+a¡S_; = a_1 +a_2+··+ a_¡S;=a1+a2+⋅⋅+a¡