✅Short || C++ || Explained Solution✔️ || Beginner Friendly ||🔥 🔥 BY MR CODER
https://www.youtube.com/watch?v=tVe_V74L-Ks\nIf thumbnail is not showing click on the link directly.\n\n\n\nAlso you can SUBSCRIBE \uD83E\uDC81 \uD83E\uDC81 \uD
https://www.youtube.com/watch?v=tVe_V74L-Ks\n**If thumbnail is not showing click on the link directly.**\n\n\n\nAlso you can SUBSCRIBE \uD83E\uDC81 \uD83E\uDC81 \uD83E\uDC81 this channel for the daily leetcode challange solution.\n\n\n\n\n\n\n\nhttps://t.me/dsacoder \u2B05\u2B05 Telegram link to discuss leetcode daily questions and other dsa problems\n**If you find my solution helpful please upvote it.**\n**C++(Heap)**\n```\nclass MedianFinder {\npublic:\n    priority_queue<int> decreasing;\n    priority_queue<int, vector<int>, greater<int>> increasing;\n    bool evn = true;\n    MedianFinder() {\n    }\n    void addNum(int num) {\n        evn =!evn;\n        if(!evn){\n        decreasing.push(num);\n        increasing.push(decreasing.top());\n        decreasing.pop();}\n        else{\n              increasing.push(num);\n              decreasing.push(increasing.top());\n              increasing.pop();\n        }\n      \n    }\n    double findMedian() {\n        if (!evn) return increasing.top();\n        return (decreasing.top() + increasing.top()) / 2.0;\n    }\n};\n```\n**C++(Multi Set)**\n```\nclass MedianFinder {\nprivate:\n    multiset<int> mul_set;\n    multiset<int>::iterator itrtr = mul_set.begin();\n    bool checkodd = false;\n    \npublic:\n    MedianFinder() {}\n    \n    void addNum(int num) {\n        mul_set.insert(num);\n        checkodd = !checkodd;\n        \n        if (mul_set.size()==1 || (!checkodd && (*itrtr) <= num)) itrtr++;\n        if (checkodd && (*itrtr) > num) itrtr--;\n    }\n    \n    double findMedian() {\n        return (checkodd)? *itrtr : (*itrtr + *prev(itrtr)) / 2.0;\n    }\n    \n};\n```\n**If you find my solution helpful please upvote it.**
['C', 'C++']