Sliding Window Algorithm Variable Size