Sliding Window Median
Question (LC.480)
Example
I: [1,3,-1,-3,5,3,6,7], 4
O: [0.00000,1.00000,1.00000,4.00000,5.50000]
Window position Median
--------------- -----
[1 3 -1 -3] 5 3 6 7 0.00
1 [3 -1 -3 5] 3 6 7 1.00
1 3 [-1 -3 5 3] 6 7 1.00
1 3 -1 [-3 5 3 6] 7 4.00
1 3 -1 -3 [5 3 6 7] 5.50 Analysis
Code
Time Complexity
Last updated