Розмір відео: 1280 X 720853 X 480640 X 360
Показувати елементи керування програвачем
Автоматичне відтворення
Автоповтор
Thanks I feel this question is easy to code but hard to think of.
Why is the optimal solution O(N)? Storing 4 mins/maxes into the PQ would take O(NlogN). Wouldn't it?
At a time you would have only 4 values in the heap. I supposes its N log 4 which is N since log 4 is a constant.Hope it is clear.
this doesn't seem to work if there are duplicate?
It was fun
Thanks I feel this question is easy to code but hard to think of.
Why is the optimal solution O(N)? Storing 4 mins/maxes into the PQ would take O(NlogN). Wouldn't it?
At a time you would have only 4 values in the heap. I supposes its N log 4 which is N since log 4 is a constant.
Hope it is clear.
this doesn't seem to work if there are duplicate?
It was fun