移动窗口算法 [英] Moving window algorithm
问题描述
说我有 N
整数, M
,从范围内的每个随机选择<$ C $的数组C> [X,Y] 。
Say I have an array of n
integers, m
, each chosen randomly from the range [x,y]
.
我也有固定大小的窗口 [A,B]
,而且比小[X,Y]
这样 BA&LT; X-Y
。
I also have a window of fixed size [a,b]
, and smaller than [x,y]
such that b-a < x-y
.
从任意窗口的位置开始,任何人都可以认为一个好的算法来使用,以确定是否有可能为窗口,以移动,使得 M
中的所有元素窗口内被封闭?
Starting from an arbitrary window position, can anyone think of a good algorithm to use to determine whether it is possible for the window to be moved such that all elements of m
are enclosed within the window?
推荐答案
你就不能获得最小
和最高
从序列号 M
,看看他们是否适合在 [A,B]
的间隔?也许我没有得到窗口的意义
的事情。
Can't you just get the minimum
and maximum
number from the array m
and see if they fit in the [a,b]
interval? Maybe I don't get the meaning of the window
thing.
这篇关于移动窗口算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!