TC : O(N*LogN) | SC : O(N) | C++ | Line Sweep Algo
Code\n\nclass Solution {\npublic:\n    int maximumPopulation(vector<vector<int>>& logs) {\n        int n = logs.size();\n\n        int maxPopulation = INT_MIN, 
# Code\n```\nclass Solution {\npublic:\n    int maximumPopulation(vector<vector<int>>& logs) {\n        int n = logs.size();\n\n        int maxPopulation = INT_MIN, maxPopulationYear = 0;\n\n        map<int, int> tracker;\n\n        for (int idx = 0; idx < n; idx++) {\n            tracker[logs[idx][0]]++;\n            tracker[logs[idx][1]]--;\n        }\n        \n        int sum = 0;\n\n        for (auto it : tracker) {\n            sum += it.second;\n\n            if (sum > maxPopulation) {\n                maxPopulation = sum;\n                maxPopulationYear = it.first; \n            }    \n        }\n\n        return maxPopulationYear;\n    }\n};\n```
['Line Sweep', 'C++']