The minimum number in a subarray of size L. I have to find it for all the subarrays of the array. Is there any other way than scanning through all the subarrays individually
Scala version answer
def movingMin(windowSize: Int, array: Seq[Double]) = { (1 to array.length - (windowSize - 1)). map{i => (array.take(i + (windowSize - 1)).takeRight(windowSize)).min} }