RMQ for sliding window