Skip to content

Commit 969a83d

Browse files
authored
Update sliding-window-median.py
1 parent f6407e1 commit 969a83d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/sliding-window-median.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def full_delete(heap, to_remove, sign): # Time: O(k), Space: O(k)
6767
to_remove[nums[i-k]] += 1
6868
lazy_delete(max_heap, to_remove, -1)
6969
lazy_delete(min_heap, to_remove, 1)
70-
if len(min_heap)+len(max_heap) > 2*k: # full delete
70+
if len(min_heap)+len(max_heap) > 2*k:
7171
full_delete(max_heap, to_remove, -1)
7272
full_delete(min_heap, to_remove, 1)
7373
result.append(float(min_heap[0]) if k%2 else (min_heap[0]-max_heap[0])/2.0)

0 commit comments

Comments
 (0)