0239. 滑动窗口最大值 #67
utterances-bot
started this conversation in
Comments
Replies: 0 comments 2 replies
-
O(n)可以解决这道题。维护一个双向队列,只放近k个数中的最大值的位置,如果小于num[i],pop掉。在当前窗口下,队列中第一个数就是最大值的位置,且队列为升序。 |
Beta Was this translation helpful? Give feedback.
0 replies
-
嗯嗯,双向队列好方法~~ 同理,优先队列也是可以的。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
0239. 滑动窗口最大值 | 算法通关手册
https://algo.itcharge.cn/Solutions/0200-0299/sliding-window-maximum/
Beta Was this translation helpful? Give feedback.
All reactions