C++ Solution || brute Force || Line Sweep Algo || Comment for help !!
\n// brute force solution\n\nclass Solution\n{\npublic:\n    int maximumPopulation(vector<vector<int>> &logs)\n    {\n        int n = logs.size();\n        map<
```\n// brute force solution\n\nclass Solution\n{\npublic:\n    int maximumPopulation(vector<vector<int>> &logs)\n    {\n        int n = logs.size();\n        map<int, int> mp;\n        int max = 0;\n        int ans;\n        if (n == 1)\n            return logs[0][0];\n        for (auto i : logs)\n        {\n            for (int j = i[0]; j < i[1]; j++)\n                mp[j - 1950]++;\n        }\n        for (auto i : mp)\n        {\n            if (max < i.second)\n            {\n                max = i.second;\n                ans = i.first;\n            }\n        }\n        return ans + 1950;\n    }\n};\n\n// Line swipe algorithm\n\nclass Solution\n{\npublic:\n    int maximumPopulation(vector<vector<int>> &logs)\n    {\n        map<int, int> mp;\n        for (vector<int> log : logs)\n        {\n            mp[log[0] - 1950]++;\n            mp[log[1] - 1950]--;\n        }\n        int ans, count = 0, year;\n        for (auto i : mp)\n        {\n            count += i.second;\n            if (ans < count)\n            {\n                ans = count;\n                year = i.first;\n            }\n        }\n        return year + 1950;\n    }\n};\n\n```
[]