C++ Short and Clean Solution Using One Multiset - 5 Lines of Code
\nclass MedianFinder {\npublic:\n    MedianFinder() {}\n    \n    void addNum(int num) {\n        nums.insert(num);\n        is_even = !is_even;\n        if (it
```\nclass MedianFinder {\npublic:\n    MedianFinder() {}\n    \n    void addNum(int num) {\n        nums.insert(num);\n        is_even = !is_even;\n        if (it == nums.end() || (is_even && (*it) <= num)) it++;\n        if (!is_even && (*it) > num) it--;\n    }\n    \n    double findMedian() {\n        return (!is_even)? *it : (*it + *prev(it)) / 2.0;\n    }\n    \nprivate:\n    multiset<int> nums;\n    multiset<int>::iterator it = nums.begin();\n    bool is_even = true;\n};\n```\n**Like it? please upvote!**
['C']