Sliding Window Algorithm Variable Size Array