We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7092a70 commit 3331defCopy full SHA for 3331def
0295-Find-Median-from-Data-Stream/cpp-0295/main2.cpp
@@ -33,22 +33,20 @@ class MedianFinder {
33
return;
34
}
35
36
+ data[num] ++;
37
if(count % 2){ // odd number
- data[num] ++;
38
- count ++;
39
if(num < iter->first){
40
if(index) index --;
41
else iter --, index = iter->second - 1;
42
43
44
else{ // even number
45
46
47
if(num >= iter->first){
48
if(index + 1 < iter->second) index ++;
49
else iter ++, index = 0;
50
51
+ count ++;
52
53
54
double findMedian() {
0 commit comments