I have an array like
[5.5, 6.0, 6.0, 6.5, 6.0, 5.5, 5.5, 5.0, 4.5].
all numbers of this array differ by 0.5, and the maximum difference of two consecutive numbers is also 0.5 (they can be the same, as in the example). and there is a moving interval or field that spans, for example, 3 consecutive numbers, for example:
[(5.5, 6.0, 6.0), 6.5, 6.0, 5.5, 5.5, 5.0, 4.5] # min: 5.5, max: 6.0
and the field moves to the right in turn:
[5.5, (6.0, 6.0, 6.5), 6.0, 5.5, 5.5, 5.0, 4.5] # min: 6.0, max: 6.5
[5.5, 6.0, (6.0, 6.5, 6.0), 5.5, 5.5, 5.0, 4.5] # min: 6.0, max: 6.5
The question arises: how can I find the min and max numbers inside the field for each time window?
I can handle this when the block and array size is small, as in this example, but I need to apply it to an array size of 100000 and a box size of 10000. Using my method (I calculate each max and minimum using a for-loop for each window of time passes), it took too much time (I have another 100 arrays and need to be run many times). There is some time limit, so I need to run it as one calculation in 0.5 seconds.