Given a set containing N numbers, minimize the average where you can take out any string of consecutive numbers in the set. |N|<=100000
Ex. {5, 1, 7, 8, 2}
You can take out {1,7}, etc. but the way to minimize in this case is just to take out {7,8} which will give a minimum average of (5+2+1)/3=2.667.
NOTE:-You can't use the first or last one, so you can't take out {5} or {2}. I want to know the general procedure to minimize this. I am looking for a linear solution. thanks
{1}
considered the first or the last element in your example??? $\endgroup${5,2}
is considered a string of consecutive numbers!!! $\endgroup$