May be this problem is out of my current skill. But I spend near about 6 hours in it and ended up in some observations only which are not enough to make the solution. I am stuck . How I will merge or solve the thing when after removing a segment , the resulted array will be something like this :-
initial array : 3 1 1 2 2 2 2 1 3 3
after removing all 2 : 3 1 1 _ _ _ _ 1 3 3 ==> 3 1 1 1 3 3
Any help please..
One more thing , I did not understand the editorial of this problem!