https://leetcode.com/problems/sliding-window-maximum/?tab=Description
下面的解法真的非常巧妙。用了deque,然后模拟队列,始终只保持比当前之前更大的,因为当前之前更小的,是没有机会成为max的。
https://discuss.leetcode.com/topic/19055/java-o-n-solution-using-deque-with-explanation/2
按窗口获得中位数的题目:
https://leetcode.com/problems/sliding-window-median/?tab=Description
解法就是用堆了,排好序的,然后用 lower_bound,能够删除。
https://discuss.leetcode.com/topic/74963/o-n-log-k-c-using-multiset-and-updating-middle-iterator/2